diff --git a/admin-portal/src/icons/svg/Caffe.svg b/admin-portal/src/icons/svg/Caffe.svg deleted file mode 100644 index 670a5373..00000000 --- a/admin-portal/src/icons/svg/Caffe.svg +++ /dev/null @@ -1,249 +0,0 @@ - - - - diff --git a/admin-portal/src/icons/svg/Caffe2.svg b/admin-portal/src/icons/svg/Caffe2.svg deleted file mode 100644 index 668eef3c..00000000 --- a/admin-portal/src/icons/svg/Caffe2.svg +++ /dev/null @@ -1,236 +0,0 @@ - - - - diff --git a/admin-portal/src/icons/svg/Cntk.svg b/admin-portal/src/icons/svg/Cntk.svg deleted file mode 100644 index a78a1c12..00000000 --- a/admin-portal/src/icons/svg/Cntk.svg +++ /dev/null @@ -1,81 +0,0 @@ - - - - diff --git a/admin-portal/src/icons/svg/M.svg b/admin-portal/src/icons/svg/M.svg deleted file mode 100644 index da4008c3..00000000 --- a/admin-portal/src/icons/svg/M.svg +++ /dev/null @@ -1,1890 +0,0 @@ - - - - diff --git a/admin-portal/src/icons/svg/Mxnet.svg b/admin-portal/src/icons/svg/Mxnet.svg deleted file mode 100644 index 57489360..00000000 --- a/admin-portal/src/icons/svg/Mxnet.svg +++ /dev/null @@ -1,248 +0,0 @@ - - - - diff --git a/admin-portal/src/icons/svg/Onnx.svg b/admin-portal/src/icons/svg/Onnx.svg deleted file mode 100644 index c32cca03..00000000 --- a/admin-portal/src/icons/svg/Onnx.svg +++ /dev/null @@ -1,124 +0,0 @@ - - - - diff --git a/admin-portal/src/icons/svg/Paddle.svg b/admin-portal/src/icons/svg/Paddle.svg deleted file mode 100644 index ff9e2bbd..00000000 --- a/admin-portal/src/icons/svg/Paddle.svg +++ /dev/null @@ -1,146 +0,0 @@ - - - - diff --git a/admin-portal/src/icons/svg/Pytorch.svg b/admin-portal/src/icons/svg/Pytorch.svg deleted file mode 100644 index 39b34ef0..00000000 --- a/admin-portal/src/icons/svg/Pytorch.svg +++ /dev/null @@ -1,233 +0,0 @@ - - - - diff --git a/admin-portal/src/icons/svg/TensorFlow.svg b/admin-portal/src/icons/svg/TensorFlow.svg deleted file mode 100644 index 28e1d525..00000000 --- a/admin-portal/src/icons/svg/TensorFlow.svg +++ /dev/null @@ -1,242 +0,0 @@ - - - - diff --git a/admin-portal/src/icons/svg/cloudConnection.svg b/admin-portal/src/icons/svg/cloudConnection.svg new file mode 100644 index 00000000..5442f9e8 --- /dev/null +++ b/admin-portal/src/icons/svg/cloudConnection.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin-portal/src/icons/svg/dashboard.svg b/admin-portal/src/icons/svg/dashboard.svg deleted file mode 100644 index 5317d370..00000000 --- a/admin-portal/src/icons/svg/dashboard.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin-portal/src/icons/svg/data.svg b/admin-portal/src/icons/svg/data.svg index c7fc29bd..dec3e31a 100644 --- a/admin-portal/src/icons/svg/data.svg +++ b/admin-portal/src/icons/svg/data.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/admin-portal/src/icons/svg/deploy.svg b/admin-portal/src/icons/svg/deploy.svg new file mode 100644 index 00000000..89033ac8 --- /dev/null +++ b/admin-portal/src/icons/svg/deploy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin-portal/src/icons/svg/example.svg b/admin-portal/src/icons/svg/example.svg deleted file mode 100644 index 46f42b53..00000000 --- a/admin-portal/src/icons/svg/example.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin-portal/src/icons/svg/home.svg b/admin-portal/src/icons/svg/home.svg deleted file mode 100644 index f3329012..00000000 --- a/admin-portal/src/icons/svg/home.svg +++ /dev/null @@ -1,219 +0,0 @@ - - - - Artboard - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pixel Unit - (Vec4) - - - - Pixel Unit - (Vec4) - - - - Vertex Unit - (Vec4) - - - - Vertex Unit - (Vec4) - - - - Vertex Unit - (Vec4) - - - NVIDIA Tegra 4i GPU - - - - - - - - - - - FLOPS - - - Google - TPU v2 - - - - 45T - - - - 90T - - - - 125T - - - - 256T - - - Google - TPU v3 - - - Google - TPU3Pod - - - Ascend - 910 - - - 0 - - - 1 - - - 2 - - - 3 - - - 4 - - - 4 - - - - - - - - - - - FLOPS - - - Nvidia - DGX2 - - - - 2P - - - - 11.5P - - - - 100P - - - - 256P - - - Google - TPU2Pod - - - Google - TPU3Pod - - - Huawei - Ascend - Cluster - - - 0 - - - 1 - - - 2 - - - 3 - - - 4 - - - 4 - - - - - \ No newline at end of file diff --git a/admin-portal/src/icons/svg/image.svg b/admin-portal/src/icons/svg/image.svg index c4b9faf9..b30a0f69 100644 --- a/admin-portal/src/icons/svg/image.svg +++ b/admin-portal/src/icons/svg/image.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/admin-portal/src/icons/svg/leftPic.svg b/admin-portal/src/icons/svg/leftPic.svg deleted file mode 100644 index 03e8beb8..00000000 --- a/admin-portal/src/icons/svg/leftPic.svg +++ /dev/null @@ -1,507 +0,0 @@ - - - - diff --git a/admin-portal/src/icons/svg/link.svg b/admin-portal/src/icons/svg/link.svg deleted file mode 100644 index 48197ba4..00000000 --- a/admin-portal/src/icons/svg/link.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin-portal/src/icons/svg/model.svg b/admin-portal/src/icons/svg/model.svg deleted file mode 100644 index 1bc091f5..00000000 --- a/admin-portal/src/icons/svg/model.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin-portal/src/icons/svg/model2.svg b/admin-portal/src/icons/svg/model2.svg deleted file mode 100644 index 42288fee..00000000 --- a/admin-portal/src/icons/svg/model2.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin-portal/src/icons/svg/modelDevelop.svg b/admin-portal/src/icons/svg/modelDevelop.svg new file mode 100644 index 00000000..5a105547 --- /dev/null +++ b/admin-portal/src/icons/svg/modelDevelop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin-portal/src/icons/svg/modelManage.svg b/admin-portal/src/icons/svg/modelManage.svg new file mode 100644 index 00000000..e2c5a41e --- /dev/null +++ b/admin-portal/src/icons/svg/modelManage.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin-portal/src/icons/svg/monitor.svg b/admin-portal/src/icons/svg/monitor.svg index ffb0975e..b396b6a8 100644 --- a/admin-portal/src/icons/svg/monitor.svg +++ b/admin-portal/src/icons/svg/monitor.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/admin-portal/src/icons/svg/nested.svg b/admin-portal/src/icons/svg/nested.svg deleted file mode 100644 index 06713a86..00000000 --- a/admin-portal/src/icons/svg/nested.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin-portal/src/icons/svg/password.svg b/admin-portal/src/icons/svg/password.svg deleted file mode 100644 index e291d85d..00000000 --- a/admin-portal/src/icons/svg/password.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin-portal/src/icons/svg/platform.svg b/admin-portal/src/icons/svg/platform.svg index bf8f7660..972a7b29 100644 --- a/admin-portal/src/icons/svg/platform.svg +++ b/admin-portal/src/icons/svg/platform.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/admin-portal/src/icons/svg/resource.svg b/admin-portal/src/icons/svg/resource.svg index a8e8268f..871f5c74 100644 --- a/admin-portal/src/icons/svg/resource.svg +++ b/admin-portal/src/icons/svg/resource.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/admin-portal/src/icons/svg/rightPic.svg b/admin-portal/src/icons/svg/rightPic.svg deleted file mode 100644 index dd314570..00000000 --- a/admin-portal/src/icons/svg/rightPic.svg +++ /dev/null @@ -1,1360 +0,0 @@ - - - - diff --git a/admin-portal/src/icons/svg/table.svg b/admin-portal/src/icons/svg/table.svg deleted file mode 100644 index 0e3dc9de..00000000 --- a/admin-portal/src/icons/svg/table.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin-portal/src/icons/svg/time.svg b/admin-portal/src/icons/svg/time.svg index daaadfe1..49c2428a 100644 --- a/admin-portal/src/icons/svg/time.svg +++ b/admin-portal/src/icons/svg/time.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/admin-portal/src/icons/svg/training.svg b/admin-portal/src/icons/svg/training.svg index 2827a332..a5b14841 100644 --- a/admin-portal/src/icons/svg/training.svg +++ b/admin-portal/src/icons/svg/training.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/admin-portal/src/icons/svg/tree.svg b/admin-portal/src/icons/svg/tree.svg deleted file mode 100644 index dd4b7dd2..00000000 --- a/admin-portal/src/icons/svg/tree.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin-portal/src/icons/svg/user.svg b/admin-portal/src/icons/svg/user.svg index 1970daca..dd3083bc 100644 --- a/admin-portal/src/icons/svg/user.svg +++ b/admin-portal/src/icons/svg/user.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/admin-portal/src/router/index.js b/admin-portal/src/router/index.js index d1741d08..9010e563 100644 --- a/admin-portal/src/router/index.js +++ b/admin-portal/src/router/index.js @@ -159,7 +159,7 @@ export const constantRoutes = [ { path: '/devManager', component: Layout, - meta: { title: '模型开发', icon: 'model' }, + meta: { title: '模型开发', icon: 'modelDevelop' }, alwaysShow: true, children: [ { @@ -196,7 +196,7 @@ export const constantRoutes = [ path: 'index', name: 'modelManager', component: () => import('@/views/modelManager/index'), - meta: { title: '模型管理', icon: 'model2' } + meta: { title: '模型管理', icon: 'modelManage' } } ] }, @@ -208,7 +208,7 @@ export const constantRoutes = [ path: 'index', name: 'deployManager', component: () => import('@/views/deployManager/index'), - meta: { title: '服务管理', icon: 'model' } + meta: { title: '服务管理', icon: 'deploy' } } ] }, @@ -232,7 +232,7 @@ export const constantRoutes = [ path: 'index', name: 'cloudInterconnection', component: () => import('@/views/cloudInterconnection/index'), - meta: { title: '云际互联', icon: 'example' } + meta: { title: '云际互联', icon: 'cloudConnection' } } ] }, diff --git a/admin-portal/src/utils/index.js b/admin-portal/src/utils/index.js index 52faf01a..32fa6247 100644 --- a/admin-portal/src/utils/index.js +++ b/admin-portal/src/utils/index.js @@ -117,7 +117,7 @@ export function param2Obj(url) { } export function formatSize(size) { if (size.indexOf('m') !== -1) { - size = size.substring(0, size.length - 2) + size = size.substring(0, size.length - 1) size = size * 0.001 return size } else if (size.indexOf('Ki') !== -1) { diff --git a/admin-portal/src/views/resourceManager/components/ResourceSpec.vue b/admin-portal/src/views/resourceManager/components/ResourceSpec.vue index 70dfbadf..ce046c67 100644 --- a/admin-portal/src/views/resourceManager/components/ResourceSpec.vue +++ b/admin-portal/src/views/resourceManager/components/ResourceSpec.vue @@ -31,17 +31,6 @@ -
- -
@@ -105,9 +94,6 @@ ], resourceQuantity: { required: true, message: '请输入资源信息', trigger: ['change', 'blur'] } }, - total: 0, - pageIndex: 1, - pageSize: 10, options: [] } @@ -196,7 +182,7 @@ }, cancel() { this.addDialog = false }, getResource() { - getResource({ pageSize: this.pageSize, pageIndex: this.pageIndex }).then(response => { + getResource().then(response => { if (response.success) { if (response.data !== null && response.data.resourceSpecs !== null) { response.data.resourceSpecs.forEach( @@ -205,7 +191,6 @@ } ) this.tableData = response.data.resourceSpecs - this.total = response.data.resourceSpecs.length } else { this.tableData = [] } diff --git a/admin-portal/src/views/resourceManager/components/nodeList.vue b/admin-portal/src/views/resourceManager/components/nodeList.vue index 499cb05d..fdbeb50e 100644 --- a/admin-portal/src/views/resourceManager/components/nodeList.vue +++ b/admin-portal/src/views/resourceManager/components/nodeList.vue @@ -83,7 +83,7 @@ let percentage if (parseInt(val.allocated[key1]) === 0) { 0 - } else if ((/^\d+$/.test(val.allocated[key1])) && (/^\d+$/.test(val.capacity[key1]))) { + } else if ((/^\d+$/.test(val.allocated[key1])) && (/^\d+$/.test(val.capacity[key1]))) { percentage = val.allocated[key1] / val.capacity[key1] * 100 percentage = parseFloat(percentage.toFixed(2)) } else { diff --git a/admin-portal/vue.config.js b/admin-portal/vue.config.js index 9daf1a40..b3ac62d3 100644 --- a/admin-portal/vue.config.js +++ b/admin-portal/vue.config.js @@ -38,14 +38,14 @@ module.exports = { }, proxy: { [process.env.VUE_APP_BASE_API]: { - target: 'http://192.168.202.73/', + target: 'http://192.168.202.72/', changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '/adminserver' } }, [process.env.VUE_APP_BASE_API2]: { - target: 'http://192.168.202.73/', + target: 'http://192.168.202.72/', changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' diff --git a/deploy/charts/octopus/Chart.lock b/deploy/charts/octopus/Chart.lock index 462685d0..0b9be454 100644 --- a/deploy/charts/octopus/Chart.lock +++ b/deploy/charts/octopus/Chart.lock @@ -11,5 +11,9 @@ dependencies: - name: nginx-ingress-controller repository: https://charts.bitnami.com/bitnami version: 7.6.9 +- name: sftpgo + repository: https://charts.sagikazarmark.dev/ + version: 0.12.0 + digest: sha256:2ed3b97bc0f2f470508372a0d68181c79a7d5533cbbf23f8a72b43426a8bd316 generated: "2021-06-07T16:49:20.238863502+08:00" diff --git a/deploy/charts/octopus/Chart.yaml b/deploy/charts/octopus/Chart.yaml index 3ec36332..a0255c6a 100644 --- a/deploy/charts/octopus/Chart.yaml +++ b/deploy/charts/octopus/Chart.yaml @@ -41,6 +41,9 @@ dependencies: - name: seldon-core-operator version: 1.12.0 repository: https://storage.googleapis.com/seldon-charts +- name: sftpgo + version: 0.12.0 + repository: https://charts.sagikazarmark.dev/ home: https://octopus.openi.org.cn/ icon: https://git.openi.org.cn/OpenI/octopus/media/branch/master/logo.png diff --git a/deploy/charts/octopus/charts/sftpgo-0.12.0.tgz b/deploy/charts/octopus/charts/sftpgo-0.12.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..582df6d0cf4ba996fdb34982ff14cadbc415b77a GIT binary patch literal 11176 zcmV;ZD_7JXiwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PMZ%cH20zC_KOU6g9SIwUy7LWGCa!r@echQQJzQ)3&T-De2S8 zt5*z>kc2TwumMoEI>~vLd6s#xvvA{0lq_H3^vsw)5}5=FRfR&Ks&FYj5y_M`k7kGo zZ-JulPmlk!TCLXMt5@p(R;yM0fB#kM)t~lX9kg06_y5{@dHAQ+{=uumSAT-mSHNZI zNx4AmPpt>HRVD6UG|1 z;R1XbPslW7XdGe~z8MXGV>ZVOu8EidRrOH_Z$^XWP;w>?;AcEO?tB2ACJAN2b7oW$ zG!r7>?PhaI6x)0nRS0md@Zy@XfVUl2k?**m|GmcJ0L`7Nbc{11zWbja_PzZ>ujRJB zb0S1yfk=#*s*EESLvNzIwqO=#d|OlwL& znon-R$Q%jmGCU<*utjs*XIQ>Ks*ac;;iepOR|=e~QER}i>}xP}!PF&~H#{v&gES0> znv6DF{AwufsOb(!3`vOmOvp5^)F;W!OOzz-O9;^zhul-M-I?KbfqMp)pup2H7eu5Y z?~I9*C;6T0pEH*AElf&v_PQx_1MXoaqU}`l@rDmf|>NKxQs;?tA^V!q$pHf_55TFC@hAR+C^Mq?>wg$Yh^MNWZIuUr@nxba+&i(6AyZEmMr&IJaL zi?~~8*Uj2(NTqwBAwYzZ$LSaIenO@ZN}AjG2NZ_x6<)Y%l5i757(}I+s2Ry2*bVzl~s|?=zl!&J|L!rS!rP7vklKqyC1v#4y)SyRyPTv4-NFc>!kj{|PV7@g#o>MIgiO(Rp|DvEMoE77AS9Mfv+r z-CtHB@NzW*S{6@HvKEJ{?=Batc+UFsUg%$*(ISB7w9dNp4G>Cd37A~kb@{*CQSYwC6KppUWKP!Qli{+5zl zf#<0ZMII(nGoyhtnqh6+82hM-ilEXc^i=WQ1Y#TfG%9n%LhibWTpxZ|M!5#o^+dQt^g_m@l}%kr~peKpJ;= zpT@F4_4Rv>SsV6MXPLp-zMC3YH~fFf_$0et4}Gyn*0VXci**g|##l%elXz<1HMf&= z91=d$mXRrEez>v;uH94>+&c)wXguQH)!Xmg@lWS z)P{NGU8xXF>=y?xUT9}Cq-g*NqjM5q*4P8Vko12*%ot6l8i{Zj*|BtUB?Ej>=*_G# zKO}M*>kYWp%O6lk0vrB8Owo1JJ3fbTNc}5brDdo_z`0o%kcJe1#9K)*sMt~4#NHLX zMduWBa9e+szuRzd;1o;ml2|l!otOr?0_>`eGa=k@h#MA!EHaQ_G>mG~x3s)p)AIcq z*6wnt?Xs&})BNkY=1r};V<5*{sr~cra0F8Kt-+vGgF#mBt~lscX(}+_8-bZLn=*l= zs;nDQABED7@%4yxuStLb#{ng=Fyi>0<4GDSC3=xCtk5?`fRS9SgP}LrV0J;ikGa(1 zS#-fQZ8uHu$Rg`14R1$Mb31QaO**=5SGVnwL@~kE9cemEKrZ8kHPEsV2V*1+Mvgfr zGzM8ICSu{i#VKVNNIapBpgQM-i4=t{Nw|yRAXA$Oqc;Teh65IZjzOSZ6Y4N60KQ46 zGQ;#57KdFqI`=^Rqvdr^MR*!O;(*LakfJbL=;$#9?$2<9AVR{QVXnH7#u(B#z&ZeS zXVH@L+19~o7vG>L39+YiuPGs$I8uxFYT^jIYdrqQC>7d_!FKt+gd30vENE(0|5dRB ziCG3x{*mFJ@sO|D&@8;u#YSoj_9R|e5O=5z6u*W~qm$v|ut|h=+^XT@nh1s#of5lT z5pr9s#NKU7TOD^Dlsu2V#~giXfO)oP8EuBI84=hOh)uC*Lvv^U-+$D~`Q$ByfXZo+ zit1p@mX)LhhvOiThLs$+)nU$oW8uM&?!h(I6Re?7Intyn3jGy&&Wd)kNtl9IxGLQ}4TDl;lw z9Xkk8F5P*xhXIA00*R%~&oNiS#@GKd!GWbQ(6|`o<=V{;i4dU)r&v_>fT#XUHh)TD zBH8FkZ(dG~0flQ6mnbPzOJhx~&=E}|>02H)kZ{?0Q%Wgl2u(N9tp35v|$5suWphy8=sr^Jw``){)v z#$`warDuSM#OG!!NgL!`5TTpG zi&jhRYmk%0(ct}iK|=Do!gPR{FBQ`iE1y`>s*9Z}dRLd!9JuI9PnqKo`+~9!Cs}`n zgH%%D;yLlva7UbzX{@54(g$d6%YQA{MpY-uk3;jZ5Xrt6(Gcr0n;IE4s7Ng%lzZPA$1FcmmlQ-&4!*E8bJbbm!? zp*B~=c#b7E0=0o@oC>Vs%n`a7Ug2xCJFc)QcZCw&9resTk^Ef&Zg-_HOo=-BH=@%x3>=)E#=_Mm$~{x19fY+1hVa_W!=x zKiq%b|N9irz6WoyHb@IGa(I7!B26!r#<2;$a}3gYMRCB}&ZkeV9IM73;jq;=LCY=h zK4=@yt{$o-wl7~)uw1Ps^v{mF9|vdWqaSv5rH1f@US4xuwF@#qK88=9z&ppGwAH=5Z@askESIQY)gPt-hAp$L*={A+0uR1? zX;d)l4Jvr4dGTJ@5rHFx7#B#S+(SViJzT8bnLoa4DFpl()k`?d=8i$5y_0cD@f(M7 zMl3SD7{gx2cmR;2x(z*{CKDm&Sp*Y&EluWBm|fpe28tk|H?VP=IU=FduU^r)|AnUD zqZqD{@by}xrc+Kk1=;!T&YjHXKDgJncine+*A2VpA9_bMy{BMp(&(+Nf$Lf=30t2& zZGHL#OvPSyNgUuCu)SPdFtCv;Xf@!=mrtKO`432c_sf^9FExFi)6tfgR=QM4x+lxZ zj;$ApY%P3)p*T1@R$HPfJX2Q3W&$6=7D|%JOfM_`P{YrhmwU^VNX&)g*$>smB&$}A ztOyGfAb}KY!%t1y(OG}g>Giwkb-G3xej5?EV_8(IdGdIS#3j>1*=wzgvQFOmKsXV$ zulEnW_gY@d+i$;ay>3~PSDlq8XyPpgz+%1;#u5v6LfJK9K>>Z)Mti5s6fHqY7@sYr z|Ila2{`)w?VS*X=MDkci!EUktULEf5SM0yPwhj-T?Z2mZK7DGwaJn~%3a?f+bE@E| z=e%f|$tJ)P5?9r^n}1ZnJ5L`aSDM>SK*eJ$@EHV4V;>G*s-GkprjrS|fh~6{o7J>V zaujk$dY>rDT9~MFx4)&xY^p^`qR{r7pRtCm$_v?oB!R;i`$#HRP9t30v!>7S5F7@2 z5 z`xm}dfu$SWT)OIimSnEbnR0xXbHlPDRfpPbda9I)kF4%gRVeS#DkViG>)+-u9(-2E zBjx12_5W?b*2k^847>xbc0KuZPfb20QCw| zV(9B+=MCkzWqU9?q%AF-r7EA{x0DK8p?4XIUP24p@uFQanTBRlTphn`RQ)!NRf%+K zG0=O|*IL6hwX8MVUNZF7$!k@C*YCz(Ls0RQL4TDBDi`z2KK{xyu)D^YYODek7wIdE zdkb{S{8(~rY5}Yt+pFgjpGFCdacs|dG8*M4HSJ`h6auQ0Ezdxu)178Ma$z5KL&OCH zh|e0}LWtwtGL*(wnzbB>@-@y@D5E^wK10GBleUNuZUr{53kI4(=RH@;Uv)~s*4F*3 zHadd`TiN?9=>@M=k>%=E@^+>n9ivdrNygEJR{k-^xbS`7D8>Q9Rxz$nylceNwrkbx zE>FjBcmTU0jtlKJ;4={YUqu%;ir6iEbqliTeme(j$^Ord_dVWa5VzR>t(ONctM>oP z!{_@Sp5!TAd9&~6`+bh=u{y`bSK8TWt6Sq_4w#8kZ=q3>N2NlTnFXIAmV-7H@Jd#- zO__3k=Mt^YZU#uu|IKNfX@7GVwgTi^v-Dr;SsMQVPC~kfaQt}Jfvq3^`}>FAe_tK{ zhx>=mq>+9C* z^|aPQ{A%RtZT_1P`)+inZhhT)-C9d(9lZMzYJxwHhy7;Uth6!eo^(&Uqw`;MJL}-@ zOQUZsd#b?h$(qunYc71L6N;L7wW{*h3YFg5uychMd$6PLENTBxY5^(GuxWLA&#(Mi}g(^6|`ZS zA(`VCb3R~njLY&ZX?u$+rX|=@UNekBG5fvxQ6W%=C&MTpPt;O&zi^ee6{9#mRJ2+f zlrD#>?G+t-s-UOth8t)Cu<)BTCMjeWx@32?6mcynxgr+#RPsx*WpDml@;jCY%5K*x zGhp)wz#5uL50e)wosxOf_Us9Zg1?>}!hg(m3I|;BQpHm*4{fcW`&J&D zSk{MY&sbQwQjv#c_CtNNrAWtJ;uHI?$`YR)h$uLdt0^<3%OFbU88!k_s8I%0b4Fn! zfJ^miyYa#Czoq!^EJ2Tb4ft*O9}W+y`@df8fB(Gy>q(x923QeaEk%j*BF*{17z<=0 z#_uR2ze}4W9MHg?3&rePg^yM1BXy9|+zkm(7w(qtmqOlmo9Id>PYc7l$j(9;Q>l15 zbycOjjH!eLBYu%B^_{o=oU7F(uDK28+*m|L!B_(+*UZL3NYd<$ZlE*A3{7#Nk(H!u zhEZjTx|PB;M|AH=q(0>QP&zljtA3Np6OaET{cmshKnZ!QdEmDFzX!|f|FZbA{(pkU z3@{W2uv6~>XEL6U>>?KXE!&18HDcfF99^d^vkH9fORu#UQ(8XdqJ9>)ph-0A@X4;A zf!&x2*yT8yV|GNN1ThR-D(%f{x3vY{QQ_K6@25ODj`x-byGYT<*9y(@5S4%75mG$-w2HC^Lmqx&VJ<4y7Do&`i?Jh6jSM7sBH4z%dh$8!SSbJ@Gdlgf~ zwKg@?m!ga3D!l80*)@yT`2|F>QvP?X`BVCXr6JykjuL|QQYqP*y2D`!&EmzOHP<^8 z+EU-j&aJ)tNrG3`Pu0g(l|vw&K<-jfATw~EE=QY(brX-p`S7GuW%gH#vs-x z$c->vUIHoHz+8UvrITzXU8-z?pG$86VwFls*S8bvQuS5qY8h7j4RA0;b-?-d=IT~) zD%Slsw}Ah%pOyB1`e^3=?e>3bY5(6}_n+fGPx5ST|EGT}^FRG|)_?lg#{Yc)u4Tlt z>Hp14|MaU^{wpNp>lyy_!|SWt{k6^BYWAmhv-<0b{|g%Z>9fuMZ1X?c{Ljxro+bO= znqiN)27Jr;pI5Er`2X|$A5Zkup8qqar)Dobi-wYsxPT0y&%!S2c)&TdX@tSM9ygT~VR2}LyQ zC5YucaDxp9SgyG=pX;@44XntXnq8)=t*L|7#*SaUw=PKrStGJ#m-AUYmg{#Atn2WN z`}>d4-S_V8dvx|U>+8JXJ9YDlJ?6E0%WvsyUG@*q-v*I;b@|G=YkR%Srl;-rQrmax z``R7+H9Plj>GwPW`AvIWp>eN1Ur}>yj~ChVwEbOZd3|rMIu(&D9fBwlwp99$L0$O> z`dxQED|^bx!!_y(v_06d_dYF0*OlSsx~}tZyT3L7x}$NpV+3?(jVG}46fOY6zomrX zAV0r6tYnDIN=zur?$!FsZ(Ek$oi*OW&R29Bb~g7Hb{^AFs0H?wJ%pX7a1BZ;VP*ed zXW3}p#Am1xu4-c1J4x7Ge2$&9^U^xuY1FrP%S^Ocm9Obn+%Zb~V8@~)FYCmmMp`x$ zmIuqqlZ(pTCFRL|l84C29i5Vrh*Uk3ojOB(Gk;}SR%((?-$PtB^>`jrVm5PbHm&q^ zy_$!J&fVRbHCr=w>JtONE&k53+`Jn-d_vmHUwTZL*~B&4tjgE)i5?;?8#+aI_ac@o z?&r0*|IBCA`k%Qn_)(StZ@d5V)%S;$^}oYcub%J!dy=QRAX0m`b9FOSHDF+hZx%OL zb2ZynSUI$mJYw|V-%3@Q@$b!W7?EjA8GigWZX5r9J*=+(9~^%FJpP~L*@giU0yCYX zT}yz@w>eHp7?5}h3G%PdRObd&xs-XDC~FG%42L01Lps*?Igog|2MmWukh#f6p1((N z;A}&TrzSgaqAusgfgZMhZg_AOhYO&wswq)|1T&Qw*>k+(;m4t%3_IIk@)>+M8bUxA zcf2VPP4%xv-|@!3v!?pjzL-s$@*n#rpU2G{&=~nwX#x`xV(z@~_;upE@W$xMdEtpj z{-%sfofrSt*@h2@5t?%79e26oC5-+Z`@-=^fKgKyXY}umH|IVLaMN*o(sa(do#WH4 z7X{vwiYN*HSW3f;|C8QPw?FKDoi=V6{|Ec6>irM zS_dsS{pUZ}6%7CRk126~Lcjm>9}NCGLhQ=pXiBco?}+_v8X*#TK8^mzaR!)0M1@|Z z(>TKnj~6gyC>A)_g9*bb9fd!W9@U;yGALfik$ zBc;+Ta87-K1P&meej4FePuzOQ!mgNM*czG|Ta7)NS=KR$3+yMQX=tjl$_u9RJntDJ zL*igRtAq-=1zBCOhdVlX#-74+4NIDfnA;moS zG!BR{cAU`+0~*sgRcJA~}2PeJm@gDU0MkcKb)9(4vyH0=9`LTD>8~w89yy=bl66Tw;bLhaJb3W=Fy+7%k!{Gh- z;B451PX8GCXZ>FP&3Ui?wtL#`k38u0p??P558eI|EjpM`wdy z&UymJcJTAN zu6!li>-3>>H0qu8B^gI&{n2^nXtW2Tv-43__2=HOy9b@~-cT~+&H35so+H_L_C^-z z^<}+&S3{AkhEk85ovXj!54#yaIPP{%di}RU==Dq8=l!u}v*+iokD327Bjszfv3~wP z`2O&)I{zQEUOwmlc#>z^-kR?763z((j+vqYy z|8mfprDIq3@~w^JKyCe5I+j4K6WE;LFluI&ptK9kC6^7yd80CEO)wHE!+|m;W@I`G z7v?I-l&OpCvgL2gwDU(3jS##U4Vpt$&#q)?SJQKx7cbt?2q$QY+b>?ge_J%CL}BRD zs2MPHb%kPs&i^>h_BM=8{_FVszZ~cC@^Xy$Ol7tMh7$@X2!LNjU;(L&cHApb<^_1J ztEhZzVF<1}#W7|`V3ms(T=yCgApzN|J})mXRm(?~Vo93gs7s(J%n%0@+tY}1td4=w z30(Na;(0HuB(FIR>9`poE--5b)aT7f8isBOj28tB!&@#bHEjwmXe#YPpT>gGP}ydo zw9PFlru#TZ8yCJzU>r-PAOPihVfsdJVA|N14EpZUc_W%pOp^(e)sibQ( z`OdQ|bag5MNV&vu5~3+rVpu>2=7_0_7`d^M@dA7mMU+Nyp&bnanODk5@uWy>>l?7S zim5x!5DQ^)>%*lkdkI%~VbiVY!m7G7_vI^$IKf=NHCoj1x~=3~LD!#jU{h^k$&Zjl z=;k9z#q1-)LNcoj`zg~yW5)JM#FQQ9~U;G#GaL-kkTs-CQn^1h#~cja7-wx;J0fy zNm+oI6zzmz9|t)0aii@xE?hR}h&4kpZkkk5W^i4qZ~6Vbm#~XMhEcG{=v2aFCAi@@ zHW|M9o_BtP5-DoPoC1}-wzAREI8eYNEM_#&S!Airw<^_8nNB%yNeq_-@zTJ$Hz-O% z2``t7Z764WbLu1e>r#MeVX#w*xi+|xx=Vu2Qg>}EfjN?;p;EZA*e&B=*ldZC1I6}~ zKvy_cZ7$toyoL;?dhzpp8Z6!dZ9Cfr+Dm<|sqTbo@1G!Z94_{hg3d+BXep~nYybtZ zF%b;0MK%Ip7vK0e5oO73sL>}SM2$(4i{R+2|EBl$wcYsh&3yMk0x--9(_5l`0z9gcUg8Ic5v6dmN0Nu$zZz)Mf>xg6*E( zhUcijw9!RK&RgRUM|$#+{IoeQ@l8TGR+)^*g!r&KPF3tfj;e-fi`(!CiG{j;A=BuW z#SICUdT*%RU!W z(azeH414i{#^FL~m(th9Dhji+%h|}Z_}QWEs>qi~3ssY`%I<4*gP40LOlGK(>2^lB z$oEcq(ITJ`BC#}iJOx904Mn^hsAgu6RoifIV8&CRV_hiB*@=8LHdIzzl_A#}Fq&1i z-_~|p95`lAjGTu;jJVLt71~1G-UdA?9OpCqgctA`)S>jxaBQ+8$zR-OL^tu-`RvL^ z|7-s%{ZfB9pP`h&89$u-Gm0bA!RE>Y3$ED*%T~gbNUQi zFxl;&;c{y_^O@|9vX!}|S}0@`)>cvhh@g<9VOVQSO&E=eZ5MJmmD=u2`cw=U<~SCr z#fzS*uK*{iLT(Y4rAJx5K8V+-^ zGzO&h5f#zbnXU?WD_k|I@>@1TPmFPClVa&?C%anBp*$H@0eCTS+GkK(=|98e#jmo3 zb3DOJ8ZDC9Qr;+oh%#(!3Z<@Wj(Mfof5F1r9+D|rq8<#f&U<}9Cllfm6qZ+P9?`MYIND?q)iG0?0t97ph+deoo2e30t7$4V z8wJ`rgB~zDDA$6^N)8}E7zrbAZuv8 zDEe;?Q2_aS4bioH`D5_ICV^VRih2*;x^YT9T^L2W@g$Q=VpCUbZYu-Is6Fl??iSj0 zvvwO&cVFbb;p23Td9R(i=63!8g`s?z?IX7 zb?wZ)QSH^JDWL{faWh^Gg@v!$v_V0D1M8JlTB>b8P3_BbzI2)5f;C%3S}*Z?(9`$+ zNv~PDO@?;DRlcS@X&NfCgo6zR7vo;m_Q=uzYYZz{e(yxKwC6J@%lT!ikOnkRI!zT* zosVzC12l~VlhI5QX-T3nTR?Or`DD8>k`sQ$~pFnfy%dhE|+$|K0q?Nc*n2ZT9TwdE1mT zKU~>_by8Lwn=K+8lTae7HZZCMOU$(^R@5@~C~+~A;iTIbFY&WE?%i*dhky&#q#OFeq26iooHTFR0L&_j#jHXkK zU${)i7-u`J3Q~|Y=7&ViT)hGJ-~$RtV52RFDRPf`$LBB(see_G!s-FoEFf}lAPHMK zUAwY&b`U6oU^-HPkYDv;)2`}Evl2ZHaib1m4LT}7vk5k9k+}yh#S?rPxYr7unj?a1 zAgn~nfVm@H`5CbstCos!bcZ95itaYN$_KcrSY==~#;g8Fe$CiEr>VeMI5QstRJG-X z)JLJT?tQJk+-nkGz;QrTHaB?B@gxnEX1z!lR?QoO!Hff~n4ve=V8TJZuXFU|dm~J{ zO%s*L;;u^V+i}_4&f8Y=kZ#-6ZM!6?aHo3EzJ@Qx{>uh4j1gC1d%bzkCPnn%;*>HB zB%aVm(A{&wM2bR}B-}-Dkm>D&(HkPI=>iqCQ&mlfScT42#N8|d>`FDT2kIX!?|Ujt z(f|?%WKMzFUDWN>Ho+%^ zG><18#Z<=``F*O+c4J8eWqP~2B(vZJ*?Mr1m6WETE_$ChS%hLV#kv3C7S?K>&e_S{ z)c81s9DYS+9TTnx)i~ReB3acbl&kMPQ_MYFbssK9`N#X?Bt<}|89Z;Rsd=PKIH8l_ zKAAI|p;#v%xfQh3Mb<)k#NM&ZDejZ?BjccgCXYZYBL|D30>3S-%Yb)^c8 zN(VYoz0E!N8L^ne)3&myQm!I(rJ{txML@VuQ--EExQ{BLb2+8p>*ltdTN)mmqALtM zW!MA(fk+E1Txd5QjX4cdfx`vFSeo95E$k4vEoJuV$vB~b97Y-dXb4aMu^Dl;!&E=% z&az0kT)~vO*21*&_U#F=%i9c&@swe#46>Ivl#9bURasQmVM$FxtyP>&dm`8#@T zPp0Xx4pNa?GLfk@uct>bE{H@ccYK&(FWj^Zx<>0RR6@Z7_5I G;s5~uH0ZYg literal 0 HcmV?d00001 diff --git a/deploy/charts/octopus/requirements.yaml b/deploy/charts/octopus/requirements.yaml index 2b6107ac..6a60d6a2 100644 --- a/deploy/charts/octopus/requirements.yaml +++ b/deploy/charts/octopus/requirements.yaml @@ -16,4 +16,7 @@ dependencies: repository: https://helm.influxdata.com/ - name: seldon-core-operator version: 1.12.0 - repository: https://storage.googleapis.com/seldon-charts \ No newline at end of file + repository: https://storage.googleapis.com/seldon-charts + - name: sftpgo + version: 4.10.0 + repository: https://charts.sagikazarmark.dev/ \ No newline at end of file diff --git a/deploy/charts/octopus/templates/_helpers.tpl b/deploy/charts/octopus/templates/_helpers.tpl index 16988f6d..b94f34c2 100644 --- a/deploy/charts/octopus/templates/_helpers.tpl +++ b/deploy/charts/octopus/templates/_helpers.tpl @@ -1026,4 +1026,31 @@ app.kubernetes.io/part-of: {{ include "ambassador.name" . }} {{- define "ambassador.serviceAddr" -}} {{- printf "%s:%s" (include "ambassador.serviceName" .) (include "ambassador.port" .) -}} +{{- end -}} + +{{/******************sftpgo******************/}} + +{{- define "sftpgo.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "sftpgo.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- printf "%s-sftpgo" .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{- define "sftpgo.serviceName" -}} +{{- printf "%s" (include "sftpgo.fullname" .) -}} +{{- end -}} + +{{- define "sftpgo.serviceAddr" -}} +{{- printf "%s:%s" (include "sftpgo.serviceName" .) .Values.sftpgo.service.ports.http.port -}} {{- end -}} \ No newline at end of file diff --git a/deploy/charts/octopus/templates/base-server.yaml b/deploy/charts/octopus/templates/base-server.yaml index c1c708c3..aa374705 100644 --- a/deploy/charts/octopus/templates/base-server.yaml +++ b/deploy/charts/octopus/templates/base-server.yaml @@ -146,12 +146,17 @@ data: pytorchServer: imageAddr: {{ .Values.baseserver.data.pytorchServer.imageAddr }} version: {{ .Values.baseserver.data.pytorchServer.version }} + sftpgo: + baseUrl: {{ include "sftpgo.serviceAddr" . }} + username: {{ .Values.baseserver.data.sftpgo.username }} + password: {{ .Values.baseserver.data.sftpgo.password }} service: nfsRootPath: /octopus-storage baseServerAddr: {{ include "baseserver.httpServiceAddr" . }} dockerDatasetPath: /dataset dockerCodePath: /code dockerModelPath: /model + dockerUserHomePath: /userhome resourceLabelKey: {{ .Values.common.resourceTagKey }} billingPeriodSec: {{ .Values.baseserver.service.billingPeriodSec }} develop: diff --git a/deploy/charts/octopus/templates/openai-server.yaml b/deploy/charts/octopus/templates/openai-server.yaml index eca48116..20662944 100644 --- a/deploy/charts/octopus/templates/openai-server.yaml +++ b/deploy/charts/octopus/templates/openai-server.yaml @@ -94,7 +94,7 @@ data: service: port: {{ template "openaiserver.port" . }} targetPort: {{ template "openaiserver.port" . }} - tokenExpirationSec: 86400 + tokenExpirationSec: {{ .Values.openaiserver.service.tokenExpirationSec }} webConfig: logoAddr: "{{ .Values.openaiserver.service.webConfig.logoAddr }}" themeColor: "{{ .Values.openaiserver.service.webConfig.themeColor }}" diff --git a/deploy/charts/octopus/templates/storage/pv.yaml b/deploy/charts/octopus/templates/storage/pv.yaml index 77411b0c..11e49102 100644 --- a/deploy/charts/octopus/templates/storage/pv.yaml +++ b/deploy/charts/octopus/templates/storage/pv.yaml @@ -69,4 +69,19 @@ spec: storage: {{ .Values.pv.influxdb.requests }} accessModes: - ReadWriteMany -{{ toYaml .Values.pv.influxdb.storageType | indent 2 }} \ No newline at end of file +{{ toYaml .Values.pv.influxdb.storageType | indent 2 }} + +--- + +apiVersion: v1 +kind: PersistentVolume +metadata: + name: octopus-sftpgo-pv + labels: + pv: sftpgo-pv +spec: + capacity: + storage: {{ .Values.pv.sftpgo.requests }} + accessModes: + - ReadWriteMany +{{ toYaml .Values.pv.sftpgo.storageType | indent 2 }} diff --git a/deploy/charts/octopus/templates/storage/pvc.yaml b/deploy/charts/octopus/templates/storage/pvc.yaml index f04eacae..18206927 100644 --- a/deploy/charts/octopus/templates/storage/pvc.yaml +++ b/deploy/charts/octopus/templates/storage/pvc.yaml @@ -82,4 +82,19 @@ spec: storage: {{ .Values.pvc.logger.requests }} selector: matchLabels: - pv: logger-pv \ No newline at end of file + pv: logger-pv + +--- + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: octopus-sftpgo-pvc +spec: + accessModes: ["ReadWriteMany"] + resources: + requests: + storage: {{ .Values.pvc.sftpgo.requests }} + selector: + matchLabels: + pv: sftpgo-pv \ No newline at end of file diff --git a/deploy/charts/octopus/values.yaml b/deploy/charts/octopus/values.yaml index eb0f8333..0de45519 100644 --- a/deploy/charts/octopus/values.yaml +++ b/deploy/charts/octopus/values.yaml @@ -61,6 +61,8 @@ pvc: requests: 100Gi logger: requests: 100Gi + sftpgo: + requests: 100Gi pv: minio: @@ -93,6 +95,12 @@ pv: nfs: server: 192.168.203.72 path: /data/datasets/data/logger + sftpgo: + requests: 100Gi + storageType: + nfs: + server: 192.168.203.72 + path: /data/datasets/data/sftpgo # taskset taskset: @@ -138,8 +146,11 @@ baseserver: ambassador: #需要修改为实际的值 baseUrl: 192.168.202.73 pytorchServer: - imageAddr: swr.cn-south-1.myhuaweicloud.com/openioctopus/pytorchserver - version: 2.0.3 + imageAddr: 192.168.202.110:5000/octopus/pytorchserver + version: 2.0.4 + sftpgo: + username: admin + password: abcde service: billingPeriodSec: 1800 develop: @@ -174,6 +185,7 @@ openaiserver: username: "" password: "abcde" service: + tokenExpirationSec: 86400 webConfig: logoAddr: #格式如#94070a @@ -459,5 +471,39 @@ seldon-core-operator: PYTORCH_SERVER: protocols: seldon: - defaultImageVersion: "2.0.3" - image: "swr.cn-south-1.myhuaweicloud.com/openioctopus/pytorchserver" \ No newline at end of file + defaultImageVersion: "2.0.4" + image: "192.168.202.110:5000/octopus/pytorchserver" + +sftpgo: + image: + repository: swr.cn-south-1.myhuaweicloud.com/openioctopus/sftpgo + tag: v2.2.2 + service: + type: NodePort + ports: + sftp: + nodePort: "30022" + http: + port: "80" + nodePort: "30080" + volumes: + - name: "data" + persistentVolumeClaim: + claimName: "octopus-sftpgo-pvc" + volumeMounts: + - name: "data" + mountPath: "/var/lib/sftpgo" + subPath: "home" + - name: "data" + mountPath: "/srv/sftpgo" + subPath: "data" + envVars: + - name: "SFTPGO_DEFAULT_ADMIN_USERNAME" + value: "admin" + - name: "SFTPGO_DEFAULT_ADMIN_PASSWORD" + value: "abcde" + config: + data_provider: + create_default_admin: true + nodeSelector: + <<: *nodeSelector \ No newline at end of file diff --git a/deploy/upgrade.txt b/deploy/upgrade.txt new file mode 100644 index 00000000..86da97b4 --- /dev/null +++ b/deploy/upgrade.txt @@ -0,0 +1,2 @@ +v4.2.0 +1.sftpgo的存储路径下需要创建目录权限为1000:10000的data、home目录 \ No newline at end of file diff --git a/openai-portal/src/App.vue b/openai-portal/src/App.vue index dedd297d..f62c9c90 100644 --- a/openai-portal/src/App.vue +++ b/openai-portal/src/App.vue @@ -73,4 +73,4 @@ }, } } - \ No newline at end of file + diff --git a/openai-portal/src/api/Home.js b/openai-portal/src/api/Home.js index afabdaf7..62fae392 100644 --- a/openai-portal/src/api/Home.js +++ b/openai-portal/src/api/Home.js @@ -27,13 +27,6 @@ export function getSpace(params) { method: 'get' }) } -export function changeSpace(data) { - return request({ - url: `/v1/usermanage/user/${data.userId}/workspace`, - method: 'put', - data: { workspaceId: data.workspaceId } - }) -} // 查询用户配置 export function getUserConfig() { return request({ diff --git a/openai-portal/src/api/setting.js b/openai-portal/src/api/setting.js new file mode 100644 index 00000000..ba0b797c --- /dev/null +++ b/openai-portal/src/api/setting.js @@ -0,0 +1,8 @@ +import request from '@/utils/request' +export function updateUserFtpAccount(data) { + return request({ + url: '/v1/usermanage/user/ftpaccount', + method: 'put', + data + }) +} \ No newline at end of file diff --git a/openai-portal/src/error/index.js b/openai-portal/src/error/index.js index 2d1ebf06..073a9c80 100644 --- a/openai-portal/src/error/index.js +++ b/openai-portal/src/error/index.js @@ -170,11 +170,15 @@ const error = { 21001: '云际请求失败', 21002: '无权限访问', // 模型部署错误 - 250001: '部署使用计算框架非TF或者PT', + 25001: '部署使用计算框架非TF或者PT', 25002: '创建模型部署服务失败', 25003: '删除模型部署服务失败', 25004: '模型部署服务请求失败', - 25005: '模型权限校验失败' + 25005: '模型权限校验失败', + /* 22001-23000 ftp服务错误*/ + 22001: '接口请求错误', + 22002: '用户未存在', + 22003: '虚拟目录未属于用户', } // export function getErrorMsg(errorCode) { // let message = '' diff --git a/openai-portal/src/icons/svg/Caffe.svg b/openai-portal/src/icons/svg/Caffe.svg deleted file mode 100644 index 670a5373..00000000 --- a/openai-portal/src/icons/svg/Caffe.svg +++ /dev/null @@ -1,249 +0,0 @@ - - - - diff --git a/openai-portal/src/icons/svg/Caffe2.svg b/openai-portal/src/icons/svg/Caffe2.svg deleted file mode 100644 index 668eef3c..00000000 --- a/openai-portal/src/icons/svg/Caffe2.svg +++ /dev/null @@ -1,236 +0,0 @@ - - - - diff --git a/openai-portal/src/icons/svg/Cntk.svg b/openai-portal/src/icons/svg/Cntk.svg deleted file mode 100644 index a78a1c12..00000000 --- a/openai-portal/src/icons/svg/Cntk.svg +++ /dev/null @@ -1,81 +0,0 @@ - - - - diff --git a/openai-portal/src/icons/svg/M.svg b/openai-portal/src/icons/svg/M.svg deleted file mode 100644 index da4008c3..00000000 --- a/openai-portal/src/icons/svg/M.svg +++ /dev/null @@ -1,1890 +0,0 @@ - - - - diff --git a/openai-portal/src/icons/svg/Mxnet.svg b/openai-portal/src/icons/svg/Mxnet.svg deleted file mode 100644 index 57489360..00000000 --- a/openai-portal/src/icons/svg/Mxnet.svg +++ /dev/null @@ -1,248 +0,0 @@ - - - - diff --git a/openai-portal/src/icons/svg/Onnx.svg b/openai-portal/src/icons/svg/Onnx.svg deleted file mode 100644 index c32cca03..00000000 --- a/openai-portal/src/icons/svg/Onnx.svg +++ /dev/null @@ -1,124 +0,0 @@ - - - - diff --git a/openai-portal/src/icons/svg/Paddle.svg b/openai-portal/src/icons/svg/Paddle.svg deleted file mode 100644 index ff9e2bbd..00000000 --- a/openai-portal/src/icons/svg/Paddle.svg +++ /dev/null @@ -1,146 +0,0 @@ - - - - diff --git a/openai-portal/src/icons/svg/Pytorch.svg b/openai-portal/src/icons/svg/Pytorch.svg deleted file mode 100644 index 39b34ef0..00000000 --- a/openai-portal/src/icons/svg/Pytorch.svg +++ /dev/null @@ -1,233 +0,0 @@ - - - - diff --git a/openai-portal/src/icons/svg/TensorFlow.svg b/openai-portal/src/icons/svg/TensorFlow.svg deleted file mode 100644 index 28e1d525..00000000 --- a/openai-portal/src/icons/svg/TensorFlow.svg +++ /dev/null @@ -1,242 +0,0 @@ - - - - diff --git a/openai-portal/src/icons/svg/all.svg b/openai-portal/src/icons/svg/all.svg new file mode 100644 index 00000000..810f0960 --- /dev/null +++ b/openai-portal/src/icons/svg/all.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/openai-portal/src/icons/svg/cloudConnection.svg b/openai-portal/src/icons/svg/cloudConnection.svg new file mode 100644 index 00000000..5442f9e8 --- /dev/null +++ b/openai-portal/src/icons/svg/cloudConnection.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/openai-portal/src/icons/svg/data.svg b/openai-portal/src/icons/svg/data.svg deleted file mode 100644 index c7fc29bd..00000000 --- a/openai-portal/src/icons/svg/data.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/openai-portal/src/icons/svg/dataset.svg b/openai-portal/src/icons/svg/dataset.svg new file mode 100644 index 00000000..dec3e31a --- /dev/null +++ b/openai-portal/src/icons/svg/dataset.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/openai-portal/src/icons/svg/deploy.svg b/openai-portal/src/icons/svg/deploy.svg index b9e861ee..89033ac8 100644 --- a/openai-portal/src/icons/svg/deploy.svg +++ b/openai-portal/src/icons/svg/deploy.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/openai-portal/src/icons/svg/example.svg b/openai-portal/src/icons/svg/example.svg deleted file mode 100644 index 46f42b53..00000000 --- a/openai-portal/src/icons/svg/example.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/openai-portal/src/icons/svg/home.svg b/openai-portal/src/icons/svg/home.svg deleted file mode 100644 index f3329012..00000000 --- a/openai-portal/src/icons/svg/home.svg +++ /dev/null @@ -1,219 +0,0 @@ - - - - Artboard - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pixel Unit - (Vec4) - - - - Pixel Unit - (Vec4) - - - - Vertex Unit - (Vec4) - - - - Vertex Unit - (Vec4) - - - - Vertex Unit - (Vec4) - - - NVIDIA Tegra 4i GPU - - - - - - - - - - - FLOPS - - - Google - TPU v2 - - - - 45T - - - - 90T - - - - 125T - - - - 256T - - - Google - TPU v3 - - - Google - TPU3Pod - - - Ascend - 910 - - - 0 - - - 1 - - - 2 - - - 3 - - - 4 - - - 4 - - - - - - - - - - - FLOPS - - - Nvidia - DGX2 - - - - 2P - - - - 11.5P - - - - 100P - - - - 256P - - - Google - TPU2Pod - - - Google - TPU3Pod - - - Huawei - Ascend - Cluster - - - 0 - - - 1 - - - 2 - - - 3 - - - 4 - - - 4 - - - - - \ No newline at end of file diff --git a/openai-portal/src/icons/svg/image.svg b/openai-portal/src/icons/svg/image.svg index c4b9faf9..b30a0f69 100644 --- a/openai-portal/src/icons/svg/image.svg +++ b/openai-portal/src/icons/svg/image.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/openai-portal/src/icons/svg/leftPic.svg b/openai-portal/src/icons/svg/leftPic.svg deleted file mode 100644 index 03e8beb8..00000000 --- a/openai-portal/src/icons/svg/leftPic.svg +++ /dev/null @@ -1,507 +0,0 @@ - - - - diff --git a/openai-portal/src/icons/svg/link.svg b/openai-portal/src/icons/svg/link.svg deleted file mode 100644 index 48197ba4..00000000 --- a/openai-portal/src/icons/svg/link.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/openai-portal/src/icons/svg/model.svg b/openai-portal/src/icons/svg/model.svg deleted file mode 100644 index 1bc091f5..00000000 --- a/openai-portal/src/icons/svg/model.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/openai-portal/src/icons/svg/model2.svg b/openai-portal/src/icons/svg/model2.svg deleted file mode 100644 index 42288fee..00000000 --- a/openai-portal/src/icons/svg/model2.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/openai-portal/src/icons/svg/modelDevelop.svg b/openai-portal/src/icons/svg/modelDevelop.svg new file mode 100644 index 00000000..5a105547 --- /dev/null +++ b/openai-portal/src/icons/svg/modelDevelop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/openai-portal/src/icons/svg/modelManage.svg b/openai-portal/src/icons/svg/modelManage.svg new file mode 100644 index 00000000..e2c5a41e --- /dev/null +++ b/openai-portal/src/icons/svg/modelManage.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/openai-portal/src/icons/svg/nested.svg b/openai-portal/src/icons/svg/nested.svg deleted file mode 100644 index 06713a86..00000000 --- a/openai-portal/src/icons/svg/nested.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/openai-portal/src/icons/svg/overView.svg b/openai-portal/src/icons/svg/overView.svg deleted file mode 100644 index b86474fb..00000000 --- a/openai-portal/src/icons/svg/overView.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/openai-portal/src/icons/svg/password.svg b/openai-portal/src/icons/svg/password.svg deleted file mode 100644 index e291d85d..00000000 --- a/openai-portal/src/icons/svg/password.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/openai-portal/src/icons/svg/rightPic.svg b/openai-portal/src/icons/svg/rightPic.svg deleted file mode 100644 index dd314570..00000000 --- a/openai-portal/src/icons/svg/rightPic.svg +++ /dev/null @@ -1,1360 +0,0 @@ - - - - diff --git a/openai-portal/src/icons/svg/setting.svg b/openai-portal/src/icons/svg/setting.svg new file mode 100644 index 00000000..4ccd3536 --- /dev/null +++ b/openai-portal/src/icons/svg/setting.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/openai-portal/src/icons/svg/table.svg b/openai-portal/src/icons/svg/table.svg deleted file mode 100644 index 0e3dc9de..00000000 --- a/openai-portal/src/icons/svg/table.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/openai-portal/src/icons/svg/training.svg b/openai-portal/src/icons/svg/training.svg index 2827a332..a5b14841 100644 --- a/openai-portal/src/icons/svg/training.svg +++ b/openai-portal/src/icons/svg/training.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/openai-portal/src/icons/svg/tree.svg b/openai-portal/src/icons/svg/tree.svg deleted file mode 100644 index dd4b7dd2..00000000 --- a/openai-portal/src/icons/svg/tree.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/openai-portal/src/layout/components/Navbar.vue b/openai-portal/src/layout/components/Navbar.vue index cf763d3a..08f895bd 100644 --- a/openai-portal/src/layout/components/Navbar.vue +++ b/openai-portal/src/layout/components/Navbar.vue @@ -1,41 +1,52 @@ @@ -56,7 +67,7 @@ options: [], circleUrl: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png", size: 'small', - current: '默认群组', + current: '', userMsg: undefined, fontColor: this.GLOBAL.THEME_COLOR ? '#FFFFFF' : '' // mainColor: curColor @@ -69,7 +80,6 @@ 'name', 'workspaces', 'id', - 'workspaceId' ]) }, created() { @@ -100,6 +110,15 @@ } ) }) + if (JSON.parse(localStorage.getItem('space'))) { + this.current = JSON.parse(localStorage.getItem('space')).workspaceName + } + else { + this.current = '默认群组' + let data = { workspaceName: '默认群组', workspaceId: 'default-workspace' } + data = JSON.stringify(data) + localStorage.setItem('space', data) + } }, toggleSideBar() { this.$store.dispatch('app/toggleSideBar') @@ -107,25 +126,16 @@ async logout() { await this.$store.dispatch('user/logout') this.$router.push(`/?redirect=${this.$route.fullPath}`) - // location.reload() + localStorage.clear(); }, handleCommand(command) { // 切换群组页面刷新但是保留页面当前群组状态 - const data = { userId: this.id, workspaceId: command.id } + let data = { workspaceName: command.name, workspaceId: command.id } + data = JSON.stringify(data) this.current = command.name - changeSpace(data).then(response => { - this.$message({ - message: '切换成功', - type: 'success' - }); - location.reload() - }) + localStorage.setItem('space', data) + location.reload(); }, - // changeColor(newColor) { - // changeThemeColor(newColor).then(() => { - // this.$message.success('主题色切换成功') - // }) - // } }, } @@ -156,7 +166,7 @@ } .right-menu { - margin: 20px 30px 0 20px; + margin: 20px 40px 0 20px; float: right; height: 100%; color: #409EFF; @@ -182,6 +192,7 @@ } } } + .pkuNavbar { height: 60px; overflow: hidden; @@ -205,32 +216,5 @@ .breadcrumb-container { float: left; } - - .right-menu { - margin: 20px 30px 0 20px; - float: right; - height: 100%; - color: #409EFF; - font-size: 20px; - - .avatar-container { - margin-right: 30px; - } - - .el-dropdown { - position: relative; - top: -8px; - display: inline-block; - color: #fff; - font-size: 15px; - margin-right: 5px; - margin-left: 5px - } - - .manual { - color: #666699; - margin: 0 50px 0 10px; - } - } } \ No newline at end of file diff --git a/openai-portal/src/permission.js b/openai-portal/src/permission.js index c618d161..d3457fe1 100644 --- a/openai-portal/src/permission.js +++ b/openai-portal/src/permission.js @@ -8,7 +8,7 @@ import getPageTitle from '@/utils/get-page-title' import { GetUrlParam } from '@/utils/index.js' NProgress.configure({ showSpinner: false }) // NProgress Configuration const whiteList = ['/', '/register'] // no redirect whitelist -router.beforeEach(async (to, from, next) => { +router.beforeEach(async(to, from, next) => { // start progress bar NProgress.start() diff --git a/openai-portal/src/router/index.js b/openai-portal/src/router/index.js index cd76b251..033075fa 100644 --- a/openai-portal/src/router/index.js +++ b/openai-portal/src/router/index.js @@ -53,13 +53,13 @@ export const constantRoutes = [ path: '/index', name: 'index', component: () => import('@/views/GeneralView/index'), - meta: { title: '概览', icon: 'overView' } + meta: { title: '概览', icon: 'all' } }] }, { path: '/dataManager', component: Layout, - meta: { title: '数据管理', icon: 'data' }, + meta: { title: '数据管理', icon: 'dataset' }, alwaysShow: true, children: [ { @@ -85,7 +85,7 @@ export const constantRoutes = [ { path: '/modelDev', component: Layout, - meta: { title: '模型开发', icon: 'model' }, + meta: { title: '模型开发', icon: 'modelDevelop' }, alwaysShow: true, children: [ { @@ -122,7 +122,7 @@ export const constantRoutes = [ path: 'index', name: 'modelManager', component: () => import('@/views/modelManager/index'), - meta: { title: '模型管理', icon: 'model2' } + meta: { title: '模型管理', icon: 'modelManage' } } ] }, @@ -134,7 +134,7 @@ export const constantRoutes = [ path: 'index', name: 'modelDeploy', component: () => import('@/views/deployManager/index'), - meta: { title: '部署服务', icon: 'model' } + meta: { title: '部署服务', icon: 'deploy' } } ] }, @@ -146,7 +146,21 @@ export const constantRoutes = [ path: 'index', name: 'cloudInterconnection', component: () => import('@/views/cloudInterconnection/index'), - meta: { title: '云际互联', icon: 'example' } + meta: { title: '云际互联', icon: 'cloudConnection' } + } + ] + }, + { + path: '/setting', + component: Layout, + meta: { title: '设置', icon: 'setting' }, + alwaysShow: true, + children: [ + { + path: 'ftp', + name: 'ftp', + component: () => import('@/views/setting/ftp'), + meta: { title: 'ftp', icon: 'dot' } } ] }, diff --git a/openai-portal/src/store/getters.js b/openai-portal/src/store/getters.js index 4200654a..41e52e4d 100644 --- a/openai-portal/src/store/getters.js +++ b/openai-portal/src/store/getters.js @@ -6,7 +6,7 @@ const getters = { name: state => state.user.name, workspaces: state => state.user.workspaces, id: state => state.user.id, - workspaceId: state => state.user.workspaceId + progressId: state => state.user.progressId } export default getters diff --git a/openai-portal/src/store/modules/user.js b/openai-portal/src/store/modules/user.js index bbc65a4d..f867522e 100644 --- a/openai-portal/src/store/modules/user.js +++ b/openai-portal/src/store/modules/user.js @@ -10,7 +10,6 @@ const getDefaultState = () => { avatar: '', id: '', workspaces: [], - workspaceId: '', progressId: undefined } } @@ -36,9 +35,6 @@ const mutations = { SET_SPACE: (state, workspaces) => { state.workspaces = workspaces }, - SET_WORKSPACEID: (state, workspaceId) => { - state.workspaceId = workspaceId - }, SET_PROGRESSID: (state, progressId) => { state.progressId = progressId } @@ -76,10 +72,8 @@ const actions = { return reject('验证失败,请重新登录。') } const { fullName, id } = data.user - const workspaceId = data.workspaceId commit('SET_NAME', fullName) commit('SET_ID', id) - commit('SET_WORKSPACEID', workspaceId) resolve() }).catch(error => { reject(error) diff --git a/openai-portal/src/utils/request.js b/openai-portal/src/utils/request.js index 66e8ee42..9bc3f404 100644 --- a/openai-portal/src/utils/request.js +++ b/openai-portal/src/utils/request.js @@ -1,5 +1,6 @@ import axios from 'axios' import { Message } from 'element-ui' +// import store from '@/store' import { getToken, removeToken } from '@/utils/auth' import router from '../router' // create an axios instance @@ -18,6 +19,9 @@ service.interceptors.request.use( // ['X-Token'] is a custom headers key // please modify it according to the actual situation config.headers['Authorization'] = 'Bearer ' + getToken() + if (localStorage.getItem('space')) { + config.headers['Octopus-Space-Id'] = JSON.parse(localStorage.getItem('space')).workspaceId + } } // eslint-disable-next-line no-undef return config @@ -50,7 +54,6 @@ service.interceptors.response.use( if (response.status === 200 && response.data === '' && response.headers.url) { window.open(response.headers.url, '_blank') } else if (!response.data.success && (response.data.error.subcode === 16004 || response.data.error.subcode === 16010 || response.data.error.subcode === 16007)) { - setTimeout(function() { removeToken() router.replace({ path: '/' }) diff --git a/openai-portal/src/views/GeneralView/index.vue b/openai-portal/src/views/GeneralView/index.vue index 10ec1302..8f7a099e 100644 --- a/openai-portal/src/views/GeneralView/index.vue +++ b/openai-portal/src/views/GeneralView/index.vue @@ -63,8 +63,10 @@
- 消费记录 - 充值记录 + 消费记录 + 充值记录
充值说明: @@ -84,12 +86,14 @@ 模型开发
- + 创建NoteBook - + 创建算法 @@ -101,12 +105,14 @@ 模型训练
- + 创建训练任务 - + 创建训练模板 @@ -191,7 +197,8 @@ 个
- + 创建算法 @@ -232,7 +239,8 @@ 个
- + 创建数据集 @@ -271,7 +279,8 @@ 个 - + 创建镜像 @@ -301,7 +310,7 @@ }, data() { return { - customColor: this.GLOBAL.THEME_COLOR?[{ color: this.GLOBAL.THEME_COLOR, percentage: 100 }]:[{ color: '#666699', percentage: 100 }], + customColor: this.GLOBAL.THEME_COLOR ? [{ color: this.GLOBAL.THEME_COLOR, percentage: 100 }] : [{ color: '#666699', percentage: 100 }], count: {}, show: false, recordRuleVisible: false, @@ -330,7 +339,7 @@ }; }, computed: { - ...mapGetters(["name", "workspaceId"]) + ...mapGetters(["name"]) }, created() { this.getTrainingTask(); @@ -385,9 +394,11 @@ this.loading = false }, getHour() { - this.groupName = this.workspaceId - if (this.workspaceId === "default-workspace") { + let workspaceId = JSON.parse(localStorage.getItem('space')).workspaceId + this.groupName = workspaceId + if (workspaceId === "default-workspace") { this.billRecordVisible = true //充值记录按钮只在默认群组中展示 + console.log(workspaceId) getUserHour().then(response => { if (response.success) { this.billAmount = response.data.billingUser.amount diff --git a/openai-portal/src/views/Home/firstPage.vue b/openai-portal/src/views/Home/firstPage.vue index 91a316ab..c4f4fed8 100644 --- a/openai-portal/src/views/Home/firstPage.vue +++ b/openai-portal/src/views/Home/firstPage.vue @@ -30,16 +30,13 @@ - -
第三方登录
-
- -
+ +
- -
{{interfaceName}}
+ + 使用{{interfaceName}}账号登录
@@ -78,7 +75,7 @@ loginForm: { email: undefined, password: undefined, - bind: { platform: '', userId:'', userName: '' } + bind: { platform: '', userId: '', userName: '' } }, rules: { email: [{ required: true, message: "请输入用户账号", trigger: "blur" }, @@ -122,6 +119,7 @@ this.loading = true this.$store.dispatch('user/login', this.loginForm).then((res) => { if (res === 'success') { + localStorage.clear() this.$router.push({ path: '/index' }) this.loading = false this.$message({ @@ -262,8 +260,16 @@ } .name { - font-weight: 800; + height: 40px; + line-height: 40px; position: relative; - top: -20px; + top: -10px; + margin-left: 5px; + font-size: 22px; + font-weight: 300; + } + + .PCLlogin { + margin-top: 20px; } \ No newline at end of file diff --git a/openai-portal/src/views/Home/register.vue b/openai-portal/src/views/Home/register.vue index a381562d..6d4129a8 100644 --- a/openai-portal/src/views/Home/register.vue +++ b/openai-portal/src/views/Home/register.vue @@ -104,7 +104,7 @@ computed: { }, methods: { - getThirdInfo() { + getThirdInfo() { removeToken() sessionStorage.setItem('thirdUserId', GetUrlParam('thirdUserId')) if (GetUrlParam("thirdUserName")) { diff --git a/openai-portal/src/views/deployManager/components/dialogForm.vue b/openai-portal/src/views/deployManager/components/dialogForm.vue index c0b7a155..9f4e168e 100644 --- a/openai-portal/src/views/deployManager/components/dialogForm.vue +++ b/openai-portal/src/views/deployManager/components/dialogForm.vue @@ -345,7 +345,7 @@ } else { if (response.error.subcode == 15011) { this.$message({ - message: '服务器名称重名', + message: '服务名称已存在', type: 'warning' }); } diff --git a/openai-portal/src/views/setting/ftp.vue b/openai-portal/src/views/setting/ftp.vue new file mode 100644 index 00000000..3276cb51 --- /dev/null +++ b/openai-portal/src/views/setting/ftp.vue @@ -0,0 +1,102 @@ + + + \ No newline at end of file diff --git a/server/admin-server/configs/config.yaml b/server/admin-server/configs/config.yaml index dda1232b..112d75f5 100644 --- a/server/admin-server/configs/config.yaml +++ b/server/admin-server/configs/config.yaml @@ -12,7 +12,7 @@ data: baseServerAddr: dns:///127.0.0.1:9001 baseServerRequestTimeout: 30s redis: - addr: 192.168.202.73:31392 + addr: 192.168.202.73:30635 username: password: abcde service: diff --git a/server/admin-server/internal/data/data.go b/server/admin-server/internal/data/data.go index ba728276..ca71525a 100644 --- a/server/admin-server/internal/data/data.go +++ b/server/admin-server/internal/data/data.go @@ -3,7 +3,6 @@ package data import ( "context" "server/admin-server/internal/conf" - "server/admin-server/internal/data/session" api "server/base-server/api/v1" "server/common/errors" "server/common/log" @@ -31,7 +30,6 @@ type Data struct { ResourceSpecClient api.ResourceSpecServiceClient ResourcePoolClient api.ResourcePoolServiceClient DatasetClient api.DatasetServiceClient - SessionClient session.SessionClient BillingClient api.BillingServiceClient LableClient api.LableServiceClient PlatformClient api.PlatformServiceClient @@ -78,12 +76,11 @@ func NewData(confData *conf.Data, logger log.Logger) (*Data, error) { ResourceSpecClient: api.NewResourceSpecServiceClient(conn), ResourcePoolClient: api.NewResourcePoolServiceClient(conn), DatasetClient: api.NewDatasetServiceClient(conn), - SessionClient: session.NewSessionClient(confData, logger), BillingClient: api.NewBillingServiceClient(conn), LableClient: api.NewLableServiceClient(conn), PlatformClient: api.NewPlatformServiceClient(conn), JointCloudClient: api.NewJointCloudServiceClient(conn), PlatformTrainJobClient: api.NewPlatformTrainJobServiceClient(conn), - ModelDeployClient: api.NewModelDeployServiceClient(conn), + ModelDeployClient: api.NewModelDeployServiceClient(conn), }, nil } diff --git a/server/admin-server/internal/data/session/session.go b/server/admin-server/internal/data/session/session.go deleted file mode 100644 index 2110aaf1..00000000 --- a/server/admin-server/internal/data/session/session.go +++ /dev/null @@ -1,50 +0,0 @@ -package session - -import ( - "context" - "server/admin-server/internal/conf" - "server/common/constant" - "server/common/log" - ss "server/common/session" -) - -type SessionClient interface { - ss.SessionStore -} - -func NewSessionClient(config *conf.Data, logger log.Logger) SessionClient { - logHelper := log.NewHelper("Session", logger) - - storeConfig := ss.SessionStoreConfig{ - RedisAddr: config.Redis.Addr, - RedisPassword: config.Redis.Password, - RedisDBIndex: "0", - } - return &SessionClientImpl{ - config: config, - store: ss.NewSessionStore(constant.SESSION_KEY, storeConfig, logger), - logger: logHelper, - } -} - -type SessionClientImpl struct { - config *conf.Data - store ss.SessionStore - logger *log.Helper -} - -func (s *SessionClientImpl) Create(ctx context.Context, session *ss.Session) error { - return s.store.Create(ctx, session) -} - -func (s *SessionClientImpl) Get(ctx context.Context, sessionId string) (*ss.Session, error) { - return s.store.Get(ctx, sessionId) -} - -func (s *SessionClientImpl) Update(ctx context.Context, session *ss.Session) error { - return s.store.Update(ctx, session) -} - -func (s *SessionClientImpl) Delete(ctx context.Context, sessionId string) error { - return s.store.Delete(ctx, sessionId) -} diff --git a/server/admin-server/internal/service/user.go b/server/admin-server/internal/service/user.go index a1a746c8..e469ee71 100644 --- a/server/admin-server/internal/service/user.go +++ b/server/admin-server/internal/service/user.go @@ -128,6 +128,14 @@ func (s *UserService) AddUser(ctx context.Context, req *pb.AddUserRequest) (*pb. return nil, err } + checkOrInitUser := &innterapi.CheckOrInitUserRequest{ + Id: user.Id, + } + _, err = s.data.UserClient.CheckOrInitUser(ctx, checkOrInitUser) + if err != nil { + return nil, err + } + return &pb.AddUserReply{ Id: user.Id, }, nil @@ -146,19 +154,6 @@ func (s *UserService) UpdateUser(ctx context.Context, req *pb.UpdateUserRequest) return nil, err } - // if updated password, reset session for user - if req.User.Password != "" { - userSession, err := s.data.SessionClient.Get(ctx, req.UserId) - if err != nil { - return nil, err - } - if userSession != nil { - if err = s.data.SessionClient.Delete(ctx, req.UserId); err != nil { - return nil, err - } - } - } - return &pb.UpdateUserReply{ User: &pb.UserItem{ Id: result.User.Id, @@ -183,16 +178,6 @@ func (s *UserService) FreezeUser(ctx context.Context, req *pb.FreezeUserRequest) return nil, err } - userSession, err := s.data.SessionClient.Get(ctx, req.UserId) - if err != nil { - return nil, err - } - if userSession != nil { - userSession.Status = int32(innterapi.UserStatus_FREEZE) - if err = s.data.SessionClient.Update(ctx, userSession); err != nil { - return nil, err - } - } return &pb.FreezeUserReply{FreezedAt: time.Now().Unix()}, nil } @@ -206,16 +191,6 @@ func (s *UserService) ThawUser(ctx context.Context, req *pb.ThawUserRequest) (*p return nil, err } - userSession, err := s.data.SessionClient.Get(ctx, req.UserId) - if err != nil { - return nil, err - } - if userSession != nil { - userSession.Status = int32(innterapi.UserStatus_ACTIVITY) - if err = s.data.SessionClient.Update(ctx, userSession); err != nil { - return nil, err - } - } return &pb.ThawUserReply{ThawedAt: time.Now().Unix()}, nil } diff --git a/server/base-server/api/v1/ftpproxy.proto b/server/base-server/api/v1/ftpproxy.proto new file mode 100644 index 00000000..f46407f2 --- /dev/null +++ b/server/base-server/api/v1/ftpproxy.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; + +package baseserver.api.v1; + +option go_package = "server/base-server/api/v1;v1"; + +import "validate/validate.proto"; + +service FtpProxyService { + rpc CreateOrUpdateFtpAccount (CreateOrUpdateFtpAccountRequest) returns (CreateOrUpdateFtpAccountReply); + rpc CreateVirtualFolder (CreateVirtualFolderRequest) returns (CreateVirtualFolderReply); + rpc DeleteVirtualFolder (DeleteVirtualFolderRequest) returns (DeleteVirtualFolderReply); +} + +message CreateOrUpdateFtpAccountRequest { + string username = 1; + string email = 2; + string password = 3; + string homeS3Bucket = 4; + string homeS3Object = 5; +} + +message CreateOrUpdateFtpAccountReply { +} + +message CreateVirtualFolderRequest { + string name = 1; + string username = 2; + string virtualPath =3; + string s3Bucket = 4; + string s3Object = 5; +} + +message CreateVirtualFolderReply { + +} + +message DeleteVirtualFolderRequest { + string name = 1; + string username = 2; +} + +message DeleteVirtualFolderReply { + +} \ No newline at end of file diff --git a/server/base-server/api/v1/trainJob.proto b/server/base-server/api/v1/trainJob.proto index a182581e..c0b0d597 100644 --- a/server/base-server/api/v1/trainJob.proto +++ b/server/base-server/api/v1/trainJob.proto @@ -39,15 +39,17 @@ service TrainJobService { message TrainJobRequest { string name = 1[(validate.rules).string = {min_len: 1,max_len: 30}]; string desc = 2; - string algorithmId = 3[(validate.rules).string = {min_len: 1}]; - string algorithmVersion = 4[(validate.rules).string = {min_len: 1}]; - string imageId = 5[(validate.rules).string = {min_len: 1}]; - string dataSetId = 6[(validate.rules).string = {min_len: 1}]; - string dataSetVersion = 7[(validate.rules).string = {min_len: 1}]; + string algorithmId = 3[(validate.rules).string = {min_len: 0}]; + string algorithmVersion = 4[(validate.rules).string = {min_len: 0}]; + string imageId = 5[(validate.rules).string = {min_len: 0}]; + string dataSetId = 6[(validate.rules).string = {min_len: 0}]; + string dataSetVersion = 7[(validate.rules).string = {min_len: 0}]; bool isDistributed = 8; repeated Config config = 9[(validate.rules).repeated.min_items = 1]; string userId = 10[(validate.rules).string = {min_len: 1}]; string workspaceId =11[(validate.rules).string = {min_len: 1}]; + //镜像地址,非必填,镜像地址和镜像ID填一个 + string imageUrl = 12[(validate.rules).string = {min_len: 0}]; } message TrainJobTemplateRequest { @@ -227,6 +229,7 @@ message TrainJob{ string imageName = 20; string dataSetName = 21; int64 startedAt = 22; + string imageUrl = 23; } diff --git a/server/base-server/api/v1/user.proto b/server/base-server/api/v1/user.proto index 09e0f23d..be00cd04 100644 --- a/server/base-server/api/v1/user.proto +++ b/server/base-server/api/v1/user.proto @@ -14,10 +14,12 @@ service UserService { rpc AddUser (AddUserRequest) returns (AddUserReply); rpc UpdateUser (UpdateUserRequest) returns (UpdateUserReply); rpc ListUserInCond (ListUserInCondRequest) returns (ListUserInCondReply); + rpc CheckOrInitUser (CheckOrInitUserRequest) returns (CheckOrInitUserReply); rpc ListUserConfigKey (ListUserConfigKeyRequest) returns (ListUserConfigKeyReply); rpc GetUserConfig (GetUserConfigRequest) returns (GetUserConfigReply); rpc UpdateUserConfig (UpdateUserConfigRequest) returns (UpdateUserConfigReply); + rpc UpdateUserFtpAccount (UpdateUserFtpAccountRequest) returns (UpdateUserFtpAccountReply); } enum UserStatus @@ -45,6 +47,7 @@ message UserItem { GenderType gender = 8; UserStatus status = 9; repeated Bind bind = 10; + string ftpUserName = 11; } message Bind { @@ -66,6 +69,14 @@ message AddUserReply { UserItem user = 1; } +message CheckOrInitUserRequest { + string id = 1; +} + +message CheckOrInitUserReply { + +} + message FindUserRequest { string id = 1 [(validate.rules).string = {min_len: 1, max_len: 36, ignore_empty:true}]; string email = 2 [(validate.rules).string = {email: true, ignore_empty:true}]; @@ -140,4 +151,14 @@ message UpdateUserConfigRequest { message UpdateUserConfigReply { +} + +message UpdateUserFtpAccountRequest { + string userId = 1; + string ftpUserName = 2 [(validate.rules).string = {pattern: "^[a-zA-Z0-9-_.~]+$"}]; + string ftpPassword = 3; +} + +message UpdateUserFtpAccountReply { + } \ No newline at end of file diff --git a/server/base-server/configs/config.yaml b/server/base-server/configs/config.yaml index 3ae7cadf..40663150 100644 --- a/server/base-server/configs/config.yaml +++ b/server/base-server/configs/config.yaml @@ -39,7 +39,7 @@ data: apiVersion: v1.0 useSSL: false redis: - addr: 192.168.202.73:31392 + addr: 192.168.202.73:30635 username: password: abcde influxdb: @@ -57,11 +57,16 @@ data: pytorchServer: imageAddr: swr.cn-south-1.myhuaweicloud.com/openioctopus/pytorchserver version: 2.0.2 + sftpgo: + baseUrl: 192.168.202.73:30080 + username: admin + password: abcde service: baseServerAddr: http://127.0.0.1:8001 dockerDatasetPath: /dataset dockerCodePath: /code dockerModelPath: /model + dockerUserHomePath: /userhome resourceLabelKey: octopus.pcl.ac.cn/type billingPeriodSec: 60 develop: @@ -91,4 +96,4 @@ module: capacity: "100Gi" nfs: server: 192.168.203.72 - path: "/data/datasets/data" \ No newline at end of file + path: "/data/datasets/data/octopus-dev-minio" \ No newline at end of file diff --git a/server/base-server/internal/common/minio_object_builder.go b/server/base-server/internal/common/minio_object_builder.go index 74cedb0d..1b9ebd31 100644 --- a/server/base-server/internal/common/minio_object_builder.go +++ b/server/base-server/internal/common/minio_object_builder.go @@ -108,3 +108,7 @@ func GetMinioDataSetObject(spaceId string, userId string, dataSetId string, vers func GetMinioTrainJobObject(spaceId string, userId string, trainJobId string) string { return fmt.Sprintf("%s/%s/%s/%s", TRAIN_JOB_FOLDER, spaceId, userId, trainJobId) } + +func GetUserHomeBucket(userId string) string { + return fmt.Sprintf("%s", userId) +} diff --git a/server/base-server/internal/conf/conf.proto b/server/base-server/internal/conf/conf.proto index a974f6a7..6c4579eb 100644 --- a/server/base-server/internal/conf/conf.proto +++ b/server/base-server/internal/conf/conf.proto @@ -107,6 +107,7 @@ message Data { JointCloud jointCloud = 8; Ambassador ambassador = 9; PytorchServer pytorchServer = 10; + sftpgo sftpgo = 11; } message Develop { @@ -136,6 +137,12 @@ message JointCloud { int32 sessionExpirySec = 4; } +message sftpgo { + string baseUrl = 1; + string username = 2; + string password = 3; +} + message Service { string baseServerAddr = 2; string dockerDatasetPath = 3; @@ -146,6 +153,7 @@ message Service { string resourceLabelKey = 8; int64 billingPeriodSec = 9; string dockerModelDeployPath = 10; + string dockerUserHomePath = 11; } message Administrator { diff --git a/server/base-server/internal/data/cluster/cluster.go b/server/base-server/internal/data/cluster/cluster.go index 65a302a5..5be214a1 100644 --- a/server/base-server/internal/data/cluster/cluster.go +++ b/server/base-server/internal/data/cluster/cluster.go @@ -32,6 +32,7 @@ type Cluster interface { CreateIngress(ctx context.Context, ingress *v1beta1.Ingress) error DeleteIngress(ctx context.Context, namespace string, name string) error CreateNamespace(ctx context.Context, namespace string) (*v1.Namespace, error) + GetNamespace(ctx context.Context, namespace string) (*v1.Namespace, error) DeleteNamespace(ctx context.Context, namespace string) error ListQueue(ctx context.Context, labelSelector string) ([]byte, error) GetQueue(ctx context.Context, name string) ([]byte, error) @@ -44,7 +45,9 @@ type Cluster interface { RemoveNodeLabel(ctx context.Context, name string, labelKey string) error CreateAndListenJob(ctx context.Context, job *batchv1.Job, callback func(e error)) error CreatePersistentVolume(ctx context.Context, pv *v1.PersistentVolume) (*v1.PersistentVolume, error) + GetPersistentVolume(ctx context.Context, name string) (*v1.PersistentVolume, error) CreatePersistentVolumeClaim(ctx context.Context, pvc *v1.PersistentVolumeClaim) (*v1.PersistentVolumeClaim, error) + GetPersistentVolumeClaim(ctx context.Context, namespace string, name string) (*v1.PersistentVolumeClaim, error) CreateSecret(ctx context.Context, secret *v1.Secret) (*v1.Secret, error) DeletePersistentVolume(ctx context.Context, name string) error DeletePersistentVolumeClaim(ctx context.Context, namespace string, name string) error diff --git a/server/base-server/internal/data/cluster/kubernetes.go b/server/base-server/internal/data/cluster/kubernetes.go index 3a0edd11..7aa433cd 100644 --- a/server/base-server/internal/data/cluster/kubernetes.go +++ b/server/base-server/internal/data/cluster/kubernetes.go @@ -270,6 +270,14 @@ func (kc *kubernetesCluster) DeleteNamespace(ctx context.Context, namespace stri return nil } +func (kc *kubernetesCluster) GetNamespace(ctx context.Context, namespace string) (*v1.Namespace, error) { + ns, err := kc.kubeclient.CoreV1().Namespaces().Get(ctx, namespace, metav1.GetOptions{}) + if err != nil { + return nil, err + } + return ns, nil +} + func (kc *kubernetesCluster) ListQueue(ctx context.Context, labelSelector string) ([]byte, error) { queues, err := kc.vcClient.SchedulingV1beta1().Queues().List(ctx, metav1.ListOptions{ @@ -431,6 +439,15 @@ func (kc *kubernetesCluster) CreatePersistentVolume(ctx context.Context, pv *v1. } return p, nil } + +func (kc *kubernetesCluster) GetPersistentVolume(ctx context.Context, name string) (*v1.PersistentVolume, error) { + p, err := kc.kubeclient.CoreV1().PersistentVolumes().Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + return p, nil +} + func (kc *kubernetesCluster) CreatePersistentVolumeClaim(ctx context.Context, pvc *v1.PersistentVolumeClaim) (*v1.PersistentVolumeClaim, error) { p, err := kc.kubeclient.CoreV1().PersistentVolumeClaims(pvc.Namespace).Create(ctx, pvc, metav1.CreateOptions{}) if err != nil { @@ -438,6 +455,15 @@ func (kc *kubernetesCluster) CreatePersistentVolumeClaim(ctx context.Context, pv } return p, nil } + +func (kc *kubernetesCluster) GetPersistentVolumeClaim(ctx context.Context, namespace string, name string) (*v1.PersistentVolumeClaim, error) { + p, err := kc.kubeclient.CoreV1().PersistentVolumeClaims(namespace).Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + return p, nil +} + func (kc *kubernetesCluster) CreateSecret(ctx context.Context, secret *v1.Secret) (*v1.Secret, error) { p, err := kc.kubeclient.CoreV1().Secrets(secret.Namespace).Create(ctx, secret, metav1.CreateOptions{}) if err != nil { diff --git a/server/base-server/internal/data/dao/model/train_job.go b/server/base-server/internal/data/dao/model/train_job.go index e30ebe1b..4d2984dc 100644 --- a/server/base-server/internal/data/dao/model/train_job.go +++ b/server/base-server/internal/data/dao/model/train_job.go @@ -28,6 +28,7 @@ type TrainJob struct { ImageId string `gorm:"type:varchar(100);not null;default:'';comment:'镜像Id'"` ImageName string `gorm:"type:varchar(100);not null;default:'';comment: '镜像名称''"` ImageVersion string `gorm:"type:varchar(100);not null;default:'';comment:'镜像版本'"` + ImageUrl string `gorm:"type:varchar(300);not null;default:'';comment:'镜像版本'"` DataSetId string `gorm:"type:varchar(100);not null;default:'';comment:'数据集Id'"` DataSetVersion string `gorm:"type:varchar(100);not null;default:'';comment:'数据集版本'"` DatasetName string `gorm:"type:varchar(100);not null;default:'';comment:'数据集名称''"` diff --git a/server/base-server/internal/data/dao/model/user.go b/server/base-server/internal/data/dao/model/user.go index ce0761b2..0ce1b393 100644 --- a/server/base-server/internal/data/dao/model/user.go +++ b/server/base-server/internal/data/dao/model/user.go @@ -33,15 +33,16 @@ func (r *Binds) Scan(input interface{}) error { type User struct { dao.Model - Id string `gorm:"type:varchar(100);not null;primaryKey;comment:'用户ID'"` - FullName string `gorm:"type:varchar(100);not null;default:'';index;comment:'姓名'"` - Gender int32 `gorm:"type:int;not null;default:0;comment:'性别:1.男,2.女'"` - Email string `gorm:"type:varchar(100);not null;default:'';index;comment:'用户邮箱'"` - Phone string `gorm:"type:varchar(100);not null;default:'';index;comment:'电话号码'"` - Password string `gorm:"type:varchar(100);not null;default:'';comment:'密码'"` - Status int32 `gorm:"type:int;not null;default:0;comment:'性别:1.冻结,2.正常'"` - Workspaces []*Workspace `gorm:"many2many:workspace_user;"` - Bind Binds `gorm:"type:json;comment:'第三方账号绑定信息'"` + Id string `gorm:"type:varchar(100);not null;primaryKey;comment:'用户ID'"` + FullName string `gorm:"type:varchar(100);not null;default:'';index;comment:'姓名'"` + Gender int32 `gorm:"type:int;not null;default:0;comment:'性别:1.男,2.女'"` + Email string `gorm:"type:varchar(100);not null;default:'';index;comment:'用户邮箱'"` + Phone string `gorm:"type:varchar(100);not null;default:'';index;comment:'电话号码'"` + Password string `gorm:"type:varchar(100);not null;default:'';comment:'密码'"` + Status int32 `gorm:"type:int;not null;default:0;comment:'性别:1.冻结,2.正常'"` + Workspaces []*Workspace `gorm:"many2many:workspace_user;"` + Bind Binds `gorm:"type:json;comment:'第三方账号绑定信息'"` + FtpUserName string `gorm:"type:varchar(100);uniqueIndex:ftpUserName;comment:'ftp用户名'"` } func (User) TableName() string { @@ -138,10 +139,11 @@ func (u UserList) Pagination(db *gorm.DB) *gorm.DB { } type UserQuery struct { - Id string - Email string - Phone string - Bind *Bind + Id string + Email string + Phone string + Bind *Bind + FtpUserName string } type UserAdd struct { @@ -156,13 +158,14 @@ type UserAdd struct { } type UserUpdate struct { - FullName string - Gender int32 - Email string - Phone string - Password string - Status int32 - Bind Binds + FullName string + Gender int32 + Email string + Phone string + Password string + Status int32 + Bind Binds + FtpUserName string } type UserUpdateCond struct { diff --git a/server/base-server/internal/data/dao/user.go b/server/base-server/internal/data/dao/user.go index 91928d22..d7ea4bf1 100644 --- a/server/base-server/internal/data/dao/user.go +++ b/server/base-server/internal/data/dao/user.go @@ -69,28 +69,31 @@ func (d *userDao) Find(ctx context.Context, condition *model.UserQuery) (*model. var result *gorm.DB if condition.Bind == nil { result = db.Where(&model.User{ - Id: condition.Id, - Email: condition.Email, - Phone: condition.Phone, + Id: condition.Id, + Email: condition.Email, + Phone: condition.Phone, + FtpUserName: condition.FtpUserName, }).First(&user) } else { querySql := "1 = 1" params := make([]interface{}, 0) - querySql += " and (JSON_CONTAINS(bind,JSON_OBJECT('platform', ?))" - params = append(params, condition.Bind.Platform) - querySql += " and JSON_CONTAINS(bind,JSON_OBJECT('userId', ?)))" - params = append(params, condition.Bind.UserId) - if condition.Id != "" { - querySql += " or id = ? " - params = append(params, condition.Id) - } if condition.Email != "" { - querySql += " or email = ? " + querySql += " and email = ? " params = append(params, condition.Email) - } - if condition.Phone != "" { - querySql += " or phone = ? " - params = append(params, condition.Phone) + if condition.Bind.UserId != "" { + querySql += " or (JSON_CONTAINS(bind,JSON_OBJECT('platform', ?))" + params = append(params, condition.Bind.Platform) + querySql += " and JSON_CONTAINS(bind,JSON_OBJECT('userId', ?)))" + params = append(params, condition.Bind.UserId) + } else { + querySql += " and JSON_CONTAINS(bind,JSON_OBJECT('platform', ?))" + params = append(params, condition.Bind.Platform) + } + } else { + querySql += " and JSON_CONTAINS(bind,JSON_OBJECT('platform', ?))" + params = append(params, condition.Bind.Platform) + querySql += " and JSON_CONTAINS(bind,JSON_OBJECT('userId', ?))" + params = append(params, condition.Bind.UserId) } result = db.Where(querySql, params...).First(&user) } @@ -121,7 +124,7 @@ func (d *userDao) Add(ctx context.Context, user *model.UserAdd) (*model.User, er Bind: bindInfo, } - result := db.Create(&u) + result := db.Omit("ftp_user_name").Create(&u) if result.Error != nil { return nil, result.Error } @@ -141,13 +144,14 @@ func (d *userDao) Update(ctx context.Context, cond *model.UserUpdateCond, user * } result := d.db.Model(&condition).Updates(model.User{ - FullName: user.FullName, - Email: user.Email, - Phone: user.Phone, - Gender: user.Gender, - Password: user.Password, - Status: user.Status, - Bind: user.Bind, + FullName: user.FullName, + Email: user.Email, + Phone: user.Phone, + Gender: user.Gender, + Password: user.Password, + Status: user.Status, + Bind: user.Bind, + FtpUserName: user.FtpUserName, }) if result.Error != nil { return nil, result.Error diff --git a/server/base-server/internal/server/grpc.go b/server/base-server/internal/server/grpc.go index 86027475..44ab3006 100644 --- a/server/base-server/internal/server/grpc.go +++ b/server/base-server/internal/server/grpc.go @@ -60,5 +60,6 @@ func NewGRPCServer(c *conf.Server, s *service.Service) *grpc.Server { api.RegisterPlatformTrainJobServiceServer(gs, s.PlatformTrainJobService) api.RegisterJointCloudServiceServer(gs, s.JointCloudService) api.RegisterModelDeployServiceServer(gs, s.ModelDeployService) + api.RegisterFtpProxyServiceServer(gs, s.FtpProxyService) return gs } diff --git a/server/base-server/internal/service/develop/develop.go b/server/base-server/internal/service/develop/develop.go index 65e27dc1..1a756db2 100644 --- a/server/base-server/internal/service/develop/develop.go +++ b/server/base-server/internal/service/develop/develop.go @@ -543,6 +543,12 @@ func (s *developService) submitJob(ctx context.Context, nb *model.Notebook, nbJo SubPath: startJobInfo.algorithmPath, ReadOnly: false, }, + { + Name: "data", + MountPath: s.conf.Service.DockerUserHomePath, + SubPath: common.GetUserHomeBucket(nb.UserId), + ReadOnly: false, + }, { Name: "localtime", MountPath: "/etc/localtime", diff --git a/server/base-server/internal/service/ftpproxy/ftp.go b/server/base-server/internal/service/ftpproxy/ftp.go new file mode 100644 index 00000000..e14949e3 --- /dev/null +++ b/server/base-server/internal/service/ftpproxy/ftp.go @@ -0,0 +1,367 @@ +package ftpproxy + +import ( + "context" + "io/ioutil" + "net/http" + "server/common/errors" + "sync" + "time" + + pb "server/base-server/api/v1" + "server/base-server/internal/conf" + "server/base-server/internal/data" + "server/common/log" + sftpgov2 "server/common/sftpgo/v2/openapi" + commUtils "server/common/utils" +) + +const ( + UNLIMITED = 0 +) + +type FtpProxyService struct { + pb.UnimplementedFtpProxyServiceServer + conf *conf.Bootstrap + data *data.Data + client *sftpgov2.APIClient + token *ftpAuthToken +} + +type ftpAuthToken struct { + mu sync.Mutex + + username string + password string + token *sftpgov2.Token + client *sftpgov2.APIClient +} + +func (t *ftpAuthToken) getToken(ctx context.Context) (string, error) { + if !t.isExpired() { + return *t.token.AccessToken, nil + } + + t.mu.Lock() + defer t.mu.Unlock() + if !t.isExpired() { + return *t.token.AccessToken, nil + } + tk, resp, err := t.client.TokenApi.GetToken(context.WithValue(ctx, sftpgov2.ContextBasicAuth, sftpgov2.BasicAuth{ + UserName: t.username, + Password: t.password, + })).Execute() + if err != nil { + log.Errorf(ctx, "FtpGO GetToken failed, err: %v", err) + return "", errors.Errorf(err, errors.ErrorSFtpGOAPIRequestFailed) + } + if resp.StatusCode == http.StatusOK { + t.token.AccessToken = tk.AccessToken + t.token.ExpiresAt = tk.ExpiresAt + return *t.token.AccessToken, nil + } + log.Errorf(ctx, "FtpGO GetToken failed, statusCode: %v", resp.StatusCode) + return "", errors.Errorf(nil, errors.ErrorSFtpGOAPIRequestFailed) +} + +func (t *ftpAuthToken) isExpired() bool { + if t.token.AccessToken == nil || *t.token.AccessToken == "" { + return true + } + // 30 seconds in advance + return !time.Now().Add(30 * time.Second).Before(*t.token.ExpiresAt) +} + +func NewFtpProxyService(conf *conf.Bootstrap, data *data.Data) pb.FtpProxyServiceServer { + config := sftpgov2.NewConfiguration() + config.Scheme = "http" + config.Host = conf.Data.Sftpgo.BaseUrl + + client := sftpgov2.NewAPIClient(config) + token := ftpAuthToken{ + client: client, + token: &sftpgov2.Token{}, + username: conf.Data.Sftpgo.Username, + password: conf.Data.Sftpgo.Password, + } + ctx := context.WithValue(context.Background(), sftpgov2.ContextServerVariables, map[string]string{ + "basePath": "v2", + }) + token.getToken(ctx) + + return &FtpProxyService{ + token: &token, + client: client, + conf: conf, + data: data, + } +} + +func (s *FtpProxyService) CreateOrUpdateFtpAccount(ctx context.Context, req *pb.CreateOrUpdateFtpAccountRequest) (*pb.CreateOrUpdateFtpAccountReply, error) { + var err error + password := "" + if req.Password != "" { + password, err = commUtils.EncryptPassword(req.Password) + if err != nil { + return nil, err + } + } + + fuser, err := s.getFtpUser(ctx, req.Username) + if err != nil && !errors.IsError(errors.ErrorSFtpGOUserNotExist, err) { + return nil, err + } + + if fuser == nil { + fuser = sftpgov2.NewUser() + fileSystemConfig := s.newFileSystemConfig(req.HomeS3Bucket, req.HomeS3Object) + permissions := map[string][]sftpgov2.Permission{ + "/": {sftpgov2.PERMISSION_STAR}, + } + + fuser.SetStatus(1) + fuser.SetUid(0) + fuser.SetGid(0) + fuser.SetMaxSessions(UNLIMITED) + fuser.SetQuotaSize(UNLIMITED) + fuser.SetQuotaFiles(UNLIMITED) + fuser.SetExpirationDate(UNLIMITED) + fuser.SetPermissions(permissions) + fuser.SetFilesystem(*fileSystemConfig) + fuser.SetUploadBandwidth(UNLIMITED) + fuser.SetDownloadBandwidth(UNLIMITED) + + fuser.SetUsername(req.Username) + fuser.SetEmail(req.Email) + fuser.SetPassword(password) + + _, err = s.createFtpUser(ctx, fuser) + if err != nil { + return nil, err + } + } else { + if req.Username != "" { + fuser.SetUsername(req.Username) + } + if req.Email != "" { + fuser.SetEmail(req.Email) + } + if req.Password != "" { + fuser.SetPassword(password) + } + err := s.updateFtpUser(ctx, *fuser, 1) + if err != nil { + return nil, err + } + } + + return &pb.CreateOrUpdateFtpAccountReply{}, nil +} + +func (s *FtpProxyService) getAuthCtx(ctx context.Context) (context.Context, error) { + ctx = context.WithValue(ctx, sftpgov2.ContextServerVariables, map[string]string{ + "basePath": "v2", + }) + token, err := s.token.getToken(ctx) + if err != nil { + return nil, err + } + return context.WithValue(ctx, sftpgov2.ContextAccessToken, token), nil +} + +func (s *FtpProxyService) getFtpUser(ctx context.Context, username string) (*sftpgov2.User, error) { + ctx, err := s.getAuthCtx(ctx) + if err != nil { + return nil, err + } + user, resp, err := s.client.UsersApi.GetUserByUsername(ctx, username).Execute() + httpStatusCode := resp.StatusCode + if err != nil && httpStatusCode != http.StatusNotFound { + return nil, err + } + + switch httpStatusCode { + case http.StatusOK: + return user, nil + case http.StatusNotFound: + return nil, errors.Errorf(err, errors.ErrorSFtpGOUserNotExist) + default: + log.Errorf(ctx, "FtpGO GetUserByUsername, username: %s, statusCode: %v", username, httpStatusCode) + return nil, errors.Errorf(nil, errors.ErrorSFtpGOAPIRequestFailed) + } +} + +func (s *FtpProxyService) createFtpUser(ctx context.Context, fuser *sftpgov2.User) (*sftpgov2.User, error) { + ctx, err := s.getAuthCtx(ctx) + if err != nil { + return nil, err + } + u, resp, err := s.client.UsersApi.AddUser(ctx).User(*fuser).Execute() + if err != nil { + s.printResponse(ctx, resp) + return nil, errors.Errorf(err, errors.ErrorSFtpGOAPIRequestFailed) + } + httpStatusCode := resp.StatusCode + switch httpStatusCode { + case http.StatusCreated: + return u, nil + default: + log.Errorf(ctx, "FtpGO createFtpUser, username: %v, statusCode: %v", fuser.Username, httpStatusCode) + return nil, errors.Errorf(nil, errors.ErrorSFtpGOAPIRequestFailed) + } +} + +func (s *FtpProxyService) newFileSystemConfig(bucket string, object string) *sftpgov2.FilesystemConfig { + accessSecret := sftpgov2.NewSecret() + accessSecret.SetPayload(s.conf.Data.Minio.Base.SecretAccessKey) + accessSecret.SetStatus("Plain") + + s3EndPoint := "://" + s.conf.Data.Minio.Base.EndPoint + if s.conf.Data.Minio.Base.UseSSL { + s3EndPoint = "https" + s3EndPoint + } else { + s3EndPoint = "http" + s3EndPoint + } + + s3Config := sftpgov2.NewS3Config() + s3Config.SetBucket(bucket) + s3Config.SetRegion("us-east-1") + s3Config.SetAccessKey(s.conf.Data.Minio.Base.AccessKeyID) + s3Config.SetAccessSecret(*accessSecret) + s3Config.SetEndpoint(s3EndPoint) + s3Config.SetForcePathStyle(true) + s3Config.SetKeyPrefix(object) + + fileSystemConfig := sftpgov2.NewFilesystemConfig() + fileSystemConfig.SetProvider(sftpgov2.FSPROVIDERS__1) + fileSystemConfig.SetS3config(*s3Config) + return fileSystemConfig +} + +func (s *FtpProxyService) updateFtpUser(ctx context.Context, user sftpgov2.User, disconnect int32) error { + for i := 0; i < len(user.VirtualFolders); i++ { + user.VirtualFolders[i].Filesystem = nil + } + ctx, err := s.getAuthCtx(ctx) + if err != nil { + return err + } + _, resp, err := s.client.UsersApi.UpdateUser(ctx, *user.Username).User(user).Disconnect(disconnect).Execute() + if err != nil { + s.printResponse(ctx, resp) + return errors.Errorf(err, errors.ErrorSFtpGOAPIRequestFailed) + } + httpStatusCode := resp.StatusCode + switch httpStatusCode { + case http.StatusOK: + return nil + default: + log.Errorf(ctx, "FtpGO updateFtpUser, username: %v, statusCode: %v", user.Username, httpStatusCode) + return errors.Errorf(nil, errors.ErrorSFtpGOAPIRequestFailed) + } +} + +func (s *FtpProxyService) CreateVirtualFolder(ctx context.Context, req *pb.CreateVirtualFolderRequest) (*pb.CreateVirtualFolderReply, error) { + folder := sftpgov2.NewBaseVirtualFolder() + folder.SetName(req.Name) + folder.SetFilesystem(*s.newFileSystemConfig(req.S3Bucket, req.S3Object)) + err := s.addVirtualFolder(ctx, *folder) + if err != nil { + return nil, err + } + + user, err := s.getFtpUser(ctx, req.Username) + if err != nil { + return nil, err + } + + vf := sftpgov2.NewVirtualFolder(req.VirtualPath) + vf.SetName(req.Name) + vf.SetVirtualPath(req.VirtualPath) + user.VirtualFolders = append(user.VirtualFolders, *vf) + + err = s.updateFtpUser(ctx, *user, 1) + if err != nil { + return nil, err + } + + return &pb.CreateVirtualFolderReply{}, nil +} + +func (s *FtpProxyService) addVirtualFolder(ctx context.Context, bvf sftpgov2.BaseVirtualFolder) error { + ctx, err := s.getAuthCtx(ctx) + if err != nil { + return err + } + _, resp, err := s.client.FoldersApi.AddFolder(ctx).BaseVirtualFolder(bvf).Execute() + if err != nil { + s.printResponse(ctx, resp) + return errors.Errorf(err, errors.ErrorSFtpGOAPIRequestFailed) + } + + httpStatusCode := resp.StatusCode + switch httpStatusCode { + case http.StatusCreated: + return nil + default: + return errors.Errorf(nil, errors.ErrorSFtpGOAPIRequestFailed) + } +} + +func (s *FtpProxyService) printResponse(ctx context.Context, r *http.Response) { + if r != nil { + bytes, _ := ioutil.ReadAll(r.Body) + log.Infof(ctx, "resp: %v", string(bytes)) + } +} + +func (s *FtpProxyService) DeleteVirtualFolder(ctx context.Context, req *pb.DeleteVirtualFolderRequest) (*pb.DeleteVirtualFolderReply, error) { + user, err := s.getFtpUser(ctx, req.Username) + if err != nil { + return nil, err + } + + hasVf := false + for _, v := range user.VirtualFolders { + if *v.Name == req.Name { + hasVf = true + } + } + + if !hasVf { + return nil, errors.Errorf(nil, errors.ErrorSFtpGOUserNotOwnVirtualDir) + } + + err = s.deleteVirtualFolder(ctx, req.Name) + if err != nil { + return nil, err + } + + user, err = s.getFtpUser(ctx, req.Username) + if err != nil { + return nil, err + } + err = s.updateFtpUser(ctx, *user, 1) + if err != nil { + return nil, err + } + return &pb.DeleteVirtualFolderReply{}, nil +} + +func (s *FtpProxyService) deleteVirtualFolder(ctx context.Context, name string) error { + ctx, err := s.getAuthCtx(ctx) + if err != nil { + return err + } + _, resp, err := s.client.FoldersApi.DeleteFolder(ctx, name).Execute() + if err != nil { + return err + } + httpStatusCode := resp.StatusCode + switch httpStatusCode { + case http.StatusOK: + return nil + default: + return errors.Errorf(nil, errors.ErrorSFtpGOAPIRequestFailed) + } +} diff --git a/server/base-server/internal/service/ftpproxy/ftp_test.go b/server/base-server/internal/service/ftpproxy/ftp_test.go new file mode 100644 index 00000000..808c243e --- /dev/null +++ b/server/base-server/internal/service/ftpproxy/ftp_test.go @@ -0,0 +1,85 @@ +package ftpproxy + +import ( + "context" + api "server/base-server/api/v1" + "server/common/errors" + "testing" + + "github.com/go-kratos/kratos/v2/middleware" + "github.com/go-kratos/kratos/v2/middleware/recovery" + "github.com/go-kratos/kratos/v2/middleware/status" + "github.com/go-kratos/kratos/v2/transport/grpc" +) + +func newClient() (api.FtpProxyServiceClient, error) { + conn, err := grpc.DialInsecure( + context.Background(), + //grpc.WithEndpoint("127.0.0.1:9001"), + grpc.WithEndpoint("dns:///127.0.0.1:9001"), //负载均衡 + grpc.WithMiddleware( + middleware.Chain( + status.Client(status.WithHandler(errors.ErrorDecode)), + recovery.Recovery(), + ), + ), + ) + if err != nil { + return nil, err + } + client := api.NewFtpProxyServiceClient(conn) + return client, nil +} + +func TestCreateOrUpdateUser(t *testing.T) { + client, err := newClient() + if err != nil { + panic(err) + } + + ctx := context.Background() + _, err = client.CreateOrUpdateUser(ctx, &api.CreateOrUpdateUserRequest{ + Username: "user1", + Email: "user1@pcl.ac.cn", + Password: "123456", + HomeS3Bucket: "user1", + }) + if err != nil { + panic(err) + } +} + +func TestCreateVirtualFolder(t *testing.T) { + client, err := newClient() + if err != nil { + panic(err) + } + + ctx := context.Background() + _, err = client.CreateVirtualFolder(ctx, &api.CreateVirtualFolderRequest{ + Name: "d1", + Username: "user1", + VirtualPath: "/dataset/d1", + S3Bucket: "virtual", + S3Object: "d1/", + }) + if err != nil { + panic(err) + } +} + +func TestDeleteVirtualFolder(t *testing.T) { + client, err := newClient() + if err != nil { + panic(err) + } + + ctx := context.Background() + _, err = client.DeleteVirtualFolder(ctx, &api.DeleteVirtualFolderRequest{ + Name: "d1", + Username: "user2", + }) + if err != nil { + panic(err) + } +} diff --git a/server/base-server/internal/service/service.go b/server/base-server/internal/service/service.go index bea0d07e..25086f39 100644 --- a/server/base-server/internal/service/service.go +++ b/server/base-server/internal/service/service.go @@ -9,16 +9,17 @@ import ( "server/base-server/internal/service/billing" "server/base-server/internal/service/dataset" "server/base-server/internal/service/develop" + "server/base-server/internal/service/ftpproxy" "server/base-server/internal/service/image" "server/base-server/internal/service/jointcloud" "server/base-server/internal/service/lable" "server/base-server/internal/service/model" + "server/base-server/internal/service/modeldeploy" "server/base-server/internal/service/platform" "server/base-server/internal/service/resources" "server/base-server/internal/service/trainjob" "server/base-server/internal/service/user" "server/base-server/internal/service/workspace" - "server/base-server/internal/service/modeldeploy" "server/common/log" ) @@ -42,7 +43,8 @@ type Service struct { PlatformService api.PlatformServiceServer PlatformTrainJobService platform.PlatformTrainJobService JointCloudService api.JointCloudServiceServer - ModelDeployService api.ModelDeployServiceServer + ModelDeployService api.ModelDeployServiceServer + FtpProxyService api.FtpProxyServiceServer } func NewService(ctx context.Context, conf *conf.Bootstrap, logger log.Logger, data *data.Data) (*Service, error) { @@ -54,7 +56,8 @@ func NewService(ctx context.Context, conf *conf.Bootstrap, logger log.Logger, da return nil, err } - service.UserService = user.NewUserService(conf, logger, data) + service.FtpProxyService = ftpproxy.NewFtpProxyService(conf, data) + service.UserService = user.NewUserService(conf, logger, data, service.FtpProxyService) service.AdminUserService = user.NewAdminUserService(conf, logger, data) service.ResourceService = resources.NewResourceService(ctx, conf, logger, data) service.ResourceSpecService = resources.NewResourceSpecService(conf, logger, data) diff --git a/server/base-server/internal/service/trainjob/train_job.go b/server/base-server/internal/service/trainjob/train_job.go index 41d79405..0cef3dff 100644 --- a/server/base-server/internal/service/trainjob/train_job.go +++ b/server/base-server/internal/service/trainjob/train_job.go @@ -302,35 +302,55 @@ func (s *trainJobService) checkPermForJob(ctx context.Context, job *model.TrainJ queue = workspace.Workspace.ResourcePoolId } - //image - image, err := s.getImageAndCheckPerm(ctx, job.UserId, job.WorkspaceId, job.ImageId) - if err != nil { - return nil, err - } - if image.Image.ImageStatus != api.ImageStatus_IMAGE_STATUS_MADE { - return nil, errors.Errorf(nil, errors.ErrorJobImageStatusForbidden) - } - job.ImageName = image.Image.ImageName - job.ImageVersion = image.Image.ImageVersion - //algorithm - algorithmVersion, err := s.getAlgorithmAndCheckPerm(ctx, job.UserId, job.WorkspaceId, job.AlgorithmId, job.AlgorithmVersion) - if err != nil { - return nil, err - } - if algorithmVersion.Algorithm.FileStatus != int64(algorithm.FILESTATUS_FINISH) { - return nil, errors.Errorf(err, errors.ErrorJobAlgorithmStatusForbidden) + imageAddr := "" + if job.ImageId != "" { //判空,允许通过API调用不传此参数 + //image + image, err := s.getImageAndCheckPerm(ctx, job.UserId, job.WorkspaceId, job.ImageId) + if err != nil { + return nil, err + } + + if image.Image.ImageStatus != api.ImageStatus_IMAGE_STATUS_MADE { + return nil, errors.Errorf(nil, errors.ErrorJobImageStatusForbidden) + } + job.ImageName = image.Image.ImageName + job.ImageVersion = image.Image.ImageVersion + imageAddr = image.ImageFullAddr + } else if job.ImageUrl != "" { + imageAddr = job.ImageUrl + } else { + return nil, errors.Errorf(nil, errors.ErrorInvalidRequestParameter) } - job.AlgorithmName = algorithmVersion.Algorithm.AlgorithmName - //dataSet - dataSetVersion, err := s.getDatasetAndCheckPerm(ctx, job.UserId, job.WorkspaceId, job.DataSetId, job.DataSetVersion) - if err != nil { - return nil, err + + algorithmPath := "" + if job.AlgorithmId != "" { //判空,允许通过API调用不传此参数 + //algorithm + algorithmVersion, err := s.getAlgorithmAndCheckPerm(ctx, job.UserId, job.WorkspaceId, job.AlgorithmId, job.AlgorithmVersion) + if err != nil { + return nil, err + } + if algorithmVersion.Algorithm.FileStatus != int64(algorithm.FILESTATUS_FINISH) { + return nil, errors.Errorf(err, errors.ErrorJobAlgorithmStatusForbidden) + } + job.AlgorithmName = algorithmVersion.Algorithm.AlgorithmName + algorithmPath = algorithmVersion.Algorithm.Path } - if dataSetVersion.Version.Status != int32(api.DatasetVersionStatus_DVS_Unzipped) { - return nil, errors.Errorf(err, errors.ErrorJobImageStatusForbidden) + + datasetPath := "" + if job.DataSetId != "" { //判空,允许通过API调用不传此参数 + //dataSet + dataSetVersion, err := s.getDatasetAndCheckPerm(ctx, job.UserId, job.WorkspaceId, job.DataSetId, job.DataSetVersion) + if err != nil { + return nil, err + } + if dataSetVersion.Version.Status != int32(api.DatasetVersionStatus_DVS_Unzipped) { + return nil, errors.Errorf(err, errors.ErrorJobImageStatusForbidden) + } + job.DatasetName = dataSetVersion.Dataset.Name + datasetPath = dataSetVersion.Version.Path } - job.DatasetName = dataSetVersion.Dataset.Name + //resource spec info startJobSpecs := map[string]*startJobInfoSpec{} specs, err := s.resourceSpecService.ListResourceSpec(ctx, &api.ListResourceSpecRequest{}) @@ -436,9 +456,9 @@ func (s *trainJobService) checkPermForJob(ctx context.Context, job *model.TrainJ return &startJobInfo{ queue: queue, - imageAddr: image.ImageFullAddr, - algorithmPath: algorithmVersion.Algorithm.Path, - datasetPath: dataSetVersion.Version.Path, + imageAddr: imageAddr, + algorithmPath: algorithmPath, + datasetPath: datasetPath, specs: startJobSpecs, }, nil } @@ -502,6 +522,12 @@ func (s *trainJobService) submitJob(ctx context.Context, job *model.TrainJob, st SubPath: s.getModelSubPath(job), ReadOnly: false, }, + { + Name: "data", + MountPath: s.conf.Service.DockerUserHomePath, + SubPath: common.GetUserHomeBucket(job.UserId), + ReadOnly: false, + }, { Name: "localtime", MountPath: "/etc/localtime", diff --git a/server/base-server/internal/service/user/user.go b/server/base-server/internal/service/user/user.go index 706110af..33f8acb1 100644 --- a/server/base-server/internal/service/user/user.go +++ b/server/base-server/internal/service/user/user.go @@ -17,13 +17,14 @@ import ( type UserService struct { api.UnimplementedUserServiceServer - conf *conf.Bootstrap - log *log.Helper - data *data.Data - defaultPVS common.PersistentVolumeSourceExtender + conf *conf.Bootstrap + log *log.Helper + data *data.Data + defaultPVS common.PersistentVolumeSourceExtender + ftpProxyService api.FtpProxyServiceServer } -func NewUserService(conf *conf.Bootstrap, logger log.Logger, data *data.Data) api.UserServiceServer { +func NewUserService(conf *conf.Bootstrap, logger log.Logger, data *data.Data, ftpProxyService api.FtpProxyServiceServer) api.UserServiceServer { pvs, err := common.BuildStorageSource(conf.Storage) if err != nil { panic(err) @@ -32,10 +33,11 @@ func NewUserService(conf *conf.Bootstrap, logger log.Logger, data *data.Data) ap panic("mod init failed, missing config [module.storage.source]") } return &UserService{ - conf: conf, - log: log.NewHelper("UserService", logger), - data: data, - defaultPVS: *pvs, + conf: conf, + log: log.NewHelper("UserService", logger), + data: data, + defaultPVS: *pvs, + ftpProxyService: ftpProxyService, } } @@ -98,6 +100,15 @@ func (s *UserService) ListUser(ctx context.Context, req *api.ListUserRequest) (* }, nil } +func (s *UserService) CheckOrInitUser(ctx context.Context, req *api.CheckOrInitUserRequest) (*api.CheckOrInitUserReply, error) { + // to check or init user home storage bucket + err := s.initUser(ctx, req.Id) + if err != nil { + return nil, err + } + return &api.CheckOrInitUserReply{}, nil +} + func (s *UserService) FindUser(ctx context.Context, req *api.FindUserRequest) (*api.FindUserReply, error) { a := model.UserQuery{ Id: req.Id, @@ -132,42 +143,59 @@ func (s *UserService) FindUser(ctx context.Context, req *api.FindUserRequest) (* } reply := &api.FindUserReply{ User: &api.UserItem{ - Id: user.Id, - FullName: user.FullName, - Email: user.Email, - Phone: user.Phone, - Gender: api.GenderType(user.Gender), - Status: api.UserStatus(user.Status), - Password: user.Password, - CreatedAt: user.CreatedAt.Unix(), - UpdatedAt: user.UpdatedAt.Unix(), - Bind: bindInfo, + Id: user.Id, + FullName: user.FullName, + Email: user.Email, + Phone: user.Phone, + FtpUserName: user.FtpUserName, + Gender: api.GenderType(user.Gender), + Status: api.UserStatus(user.Status), + Password: user.Password, + CreatedAt: user.CreatedAt.Unix(), + UpdatedAt: user.UpdatedAt.Unix(), + Bind: bindInfo, }, } return reply, nil } -func (s *UserService) initUser(ctx context.Context, user *model.User) error { +func (s *UserService) initUser(ctx context.Context, userId string) error { + err := s.data.Minio.CreateBucket(common.GetUserHomeBucket(userId)) + if err != nil { + if !errors.IsError(errors.ErrorMinioBucketExisted, err) { + return err + } + } + // create user namespace - _, err := s.data.Cluster.CreateNamespace(ctx, user.Id) + _, err = s.data.Cluster.GetNamespace(ctx, userId) if err != nil { - return err + _, err = s.data.Cluster.CreateNamespace(ctx, userId) + if err != nil { + return err + } } // create user storage pv - pv := common.BuildStoragePersistentVolume(user.Id, s.defaultPVS.Capacity) + pv := common.BuildStoragePersistentVolume(userId, s.defaultPVS.Capacity) pv.Spec.PersistentVolumeSource = s.defaultPVS.PersistentVolumeSource - _, err = s.data.Cluster.CreatePersistentVolume(ctx, pv) + _, err = s.data.Cluster.GetPersistentVolume(ctx, pv.Name) if err != nil { - return err + _, err = s.data.Cluster.CreatePersistentVolume(ctx, pv) + if err != nil { + return err + } } // create user storage pvc - pvc := common.BuildStoragePersistentVolumeChaim(user.Id, user.Id, s.defaultPVS.Capacity) - _, err = s.data.Cluster.CreatePersistentVolumeClaim(ctx, pvc) + pvc := common.BuildStoragePersistentVolumeChaim(userId, userId, s.defaultPVS.Capacity) + _, err = s.data.Cluster.GetPersistentVolumeClaim(ctx, pvc.Namespace, pvc.Name) if err != nil { - return err + _, err = s.data.Cluster.CreatePersistentVolumeClaim(ctx, pvc) + if err != nil { + return err + } } return nil @@ -212,7 +240,7 @@ func (s *UserService) AddUser(ctx context.Context, req *api.AddUserRequest) (*ap return nil, err } - if err = s.initUser(ctx, u); err != nil { + if err = s.initUser(ctx, u.Id); err != nil { s.log.Error(ctx, err) return nil, err } @@ -381,3 +409,27 @@ func (s *UserService) UpdateUserConfig(ctx context.Context, req *api.UpdateUserC return &api.UpdateUserConfigReply{}, nil } + +func (s *UserService) UpdateUserFtpAccount(ctx context.Context, req *api.UpdateUserFtpAccountRequest) (*api.UpdateUserFtpAccountReply, error) { + user, err := s.data.UserDao.Find(ctx, &model.UserQuery{Id: req.UserId}) + if err != nil { + return nil, err + } + _, err = s.ftpProxyService.CreateOrUpdateFtpAccount(ctx, &api.CreateOrUpdateFtpAccountRequest{ + Username: req.FtpUserName, + Email: user.Email, + Password: req.FtpPassword, + HomeS3Bucket: common.GetUserHomeBucket(req.UserId), + HomeS3Object: "", + }) + if err != nil { + return nil, err + } + + _, err = s.data.UserDao.Update(ctx, &model.UserUpdateCond{Id: req.UserId}, &model.UserUpdate{FtpUserName: req.FtpUserName}) + if err != nil { + return nil, err + } + + return &api.UpdateUserFtpAccountReply{}, nil +} diff --git a/server/common/context/context.go b/server/common/context/context.go index 96b1f1f8..eaa62464 100644 --- a/server/common/context/context.go +++ b/server/common/context/context.go @@ -15,6 +15,7 @@ const ( CTX_DB_TX_KEY CtxKey = "dbTx" //数据库事务 存在于common.Transaction() CTX_CREATED_AT_KEY CtxKey = "createdAt" CTX_PLATFORM_ID CtxKey = "platformId" //第三方平台Id + CTX_SPACEID_KEY CtxKey = "spaceId" //群组id ) func RequestIdKey() CtxKey { @@ -53,6 +54,26 @@ func UserIdFromContext(ctx context.Context) string { return "" } +func SpaceIdKey() CtxKey { + return CTX_SPACEID_KEY +} + +func SpaceIdToContext(ctx context.Context, val interface{}) context.Context { + return context.WithValue(ctx, SpaceIdKey(), val) +} + +func SpaceIdFromContext(ctx context.Context) string { + id, ok := ctx.Value(SpaceIdKey()).(string) + if ok { + return id + } + return "" +} + +func UserIdAndSpaceIdFromContext(ctx context.Context) (string, string) { + return UserIdFromContext(ctx), SpaceIdFromContext(ctx) +} + func PlatformIdKey() CtxKey { return CTX_PLATFORM_ID } diff --git a/server/common/errors/codes.go b/server/common/errors/codes.go index c57310ad..83d6cc8d 100644 --- a/server/common/errors/codes.go +++ b/server/common/errors/codes.go @@ -209,6 +209,11 @@ const ( ErrorModelDeployDeleteFailed = 25003 // 删除模型部署服务失败 ErrorModelInferRequest = 25004 // 模型部署服务请求失败 ErrorModelAuthFailed = 25005 // 模型权限校验失败 + + /* 22001-23000 ftp服务错误*/ + ErrorSFtpGOAPIRequestFailed = 22001 // 接口请求错误 + ErrorSFtpGOUserNotExist = 22002 // 用户未存在 + ErrorSFtpGOUserNotOwnVirtualDir = 22003 // 虚拟目录未属于用户 ) type codeMsg struct { @@ -414,4 +419,7 @@ var codeMsgMap = map[int]codeMsg{ ErrorModelDeployDeleteFailed: {codeType: Internal, msg: "delete seldon service failed"}, ErrorModelInferRequest: {codeType: Internal, msg: "seldon service http request failed"}, ErrorModelAuthFailed: {codeType: Internal, msg: "model can`t access"}, + + /* 21001-22000 云际请求错误*/ + ErrorSFtpGOAPIRequestFailed: {codeType: Internal, msg: "sftpgo api request failed"}, } diff --git a/server/common/jwt/jwt.go b/server/common/jwt/jwt.go index a478e4f5..300bba13 100644 --- a/server/common/jwt/jwt.go +++ b/server/common/jwt/jwt.go @@ -41,6 +41,9 @@ func ParseToken(tokenStr string, secret string) (*TokenClaims, error) { return nil, errors.Errorf(err, errors.ErrorParseTokenFailed) } if claims, ok := token.Claims.(*TokenClaims); ok && token.Valid { + if time.Now().Unix() > claims.ExpiresAt { + return nil, errors.Errorf(err, errors.ErrorParseTokenFailed) + } return claims, nil } else { return nil, errors.Errorf(err, errors.ErrorTokenInvalid) diff --git a/server/common/middleware/session/jwt_session.go b/server/common/middleware/session/jwt_session.go index c485a82f..528e0805 100644 --- a/server/common/middleware/session/jwt_session.go +++ b/server/common/middleware/session/jwt_session.go @@ -1,68 +1,68 @@ package session -import ( - "context" - "net/http" - commctx "server/common/context" - "server/common/errors" - ss "server/common/session" - "strings" - - "github.com/go-kratos/kratos/v2/middleware" - kratosHttp "github.com/go-kratos/kratos/v2/transport/http" -) - -// Option is HTTP logging option. -type Option func(*Options) - -type Options struct { - NoAuthUris []string - Store ss.SessionStore - CheckSession func(ctx context.Context, s *ss.Session) error -} - -// Server is an server logging middleware. -func Server(opts ...Option) middleware.Middleware { - options := Options{} - for _, o := range opts { - o(&options) - } - return func(handler middleware.Handler) middleware.Handler { - return func(ctx context.Context, req interface{}) (interface{}, error) { - var request *http.Request - if info, ok := kratosHttp.FromServerContext(ctx); ok { - request = info.Request - } else { - return handler(ctx, req) - } - - needAuth := true - for _, i := range options.NoAuthUris { - if strings.Contains(request.RequestURI, i) { - needAuth = false - } - } - - if needAuth { - userId := commctx.UserIdFromContext(ctx) - store := options.Store - session, err := store.Get(ctx, userId) - if err != nil { - return nil, errors.Errorf(err, errors.ErrorUserGetAuthSessionFailed) - } - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - if options.CheckSession != nil { - if err := options.CheckSession(ctx, session); err != nil { - return nil, err - } - } - - ctx = ss.SessionToContext(ctx, session) - } - - return handler(ctx, req) - } - } -} +//import ( +// "context" +// "net/http" +// commctx "server/common/context" +// "server/common/errors" +// ss "server/common/session" +// "strings" +// +// "github.com/go-kratos/kratos/v2/middleware" +// kratosHttp "github.com/go-kratos/kratos/v2/transport/http" +//) +// +//// Option is HTTP logging option. +//type Option func(*Options) +// +//type Options struct { +// NoAuthUris []string +// Store ss.SessionStore +// CheckSession func(ctx context.Context, s *ss.Session) error +//} +// +//// Server is an server logging middleware. +//func Server(opts ...Option) middleware.Middleware { +// options := Options{} +// for _, o := range opts { +// o(&options) +// } +// return func(handler middleware.Handler) middleware.Handler { +// return func(ctx context.Context, req interface{}) (interface{}, error) { +// var request *http.Request +// if info, ok := kratosHttp.FromServerContext(ctx); ok { +// request = info.Request +// } else { +// return handler(ctx, req) +// } +// +// needAuth := true +// for _, i := range options.NoAuthUris { +// if strings.Contains(request.RequestURI, i) { +// needAuth = false +// } +// } +// +// if needAuth { +// userId := commctx.UserIdFromContext(ctx) +// store := options.Store +// session, err := store.Get(ctx, userId) +// if err != nil { +// return nil, errors.Errorf(err, errors.ErrorUserGetAuthSessionFailed) +// } +// if session == nil { +// return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) +// } +// if options.CheckSession != nil { +// if err := options.CheckSession(ctx, session); err != nil { +// return nil, err +// } +// } +// +// ctx = ss.SessionToContext(ctx, session) +// } +// +// return handler(ctx, req) +// } +// } +//} diff --git a/server/common/session/context.go b/server/common/session/context.go index be1573a7..acdf5fe0 100644 --- a/server/common/session/context.go +++ b/server/common/session/context.go @@ -1,25 +1,25 @@ package session -import "context" - -type CtxSession string - -const ( - CTX_SESSION_KEY CtxSession = "CtxSessionKey" -) - -func CtxSessionKey() CtxSession { - return CTX_SESSION_KEY -} - -func SessionToContext(ctx context.Context, val interface{}) context.Context { - return context.WithValue(ctx, CtxSessionKey(), val) -} - -func SessionFromContext(ctx context.Context) *Session { - session, ok := ctx.Value(CtxSessionKey()).(*Session) - if ok { - return session - } - return nil -} +//import "context" +// +//type CtxSession string +// +//const ( +// CTX_SESSION_KEY CtxSession = "CtxSessionKey" +//) +// +//func CtxSessionKey() CtxSession { +// return CTX_SESSION_KEY +//} +// +//func SessionToContext(ctx context.Context, val interface{}) context.Context { +// return context.WithValue(ctx, CtxSessionKey(), val) +//} +// +//func SessionFromContext(ctx context.Context) *Session { +// session, ok := ctx.Value(CtxSessionKey()).(*Session) +// if ok { +// return session +// } +// return nil +//} diff --git a/server/common/session/session.go b/server/common/session/session.go index 9aa1b0ad..f29a5376 100644 --- a/server/common/session/session.go +++ b/server/common/session/session.go @@ -1,55 +1,55 @@ package session -import ( - "context" - "server/common/constant" -) - -const ( - SESSION_WORKSPACE = "workspace" -) - -type Session struct { - ctx context.Context `json:"-"` - store SessionStore `json:"-"` - Id string `json:"id"` - UserId string `json:"userId"` - Status int32 `json:"status"` - CreatedAt int64 `json:"createdAt"` - Attributes map[string]string `json:"attributes"` -} - -func (s *Session) GetWorkspace() string { - if workspaceId, ok := s.Attributes[SESSION_WORKSPACE]; !ok { - return constant.SYSTEM_WORKSPACE_DEFAULT - } else { - return workspaceId - } -} - -func (s *Session) SetWorkspace(workspaceId string) error { - if workspaceId == constant.SYSTEM_WORKSPACE_DEFAULT { - delete(s.Attributes, SESSION_WORKSPACE) - } else { - s.Attributes[SESSION_WORKSPACE] = workspaceId - } - return s.sync() -} - -func (s *Session) IsDefaultWorkspace() bool { - if workspaceId, ok := s.Attributes[SESSION_WORKSPACE]; !ok { - return true - } else { - return workspaceId == constant.SYSTEM_WORKSPACE_DEFAULT - } -} - -func (s *Session) sync() error { - if s.store == nil { - return nil - } - if err := s.store.Update(s.ctx, s); err != nil { - return err - } - return nil -} +//import ( +// "context" +// "server/common/constant" +//) +// +//const ( +// SESSION_WORKSPACE = "workspace" +//) +// +//type Session struct { +// ctx context.Context `json:"-"` +// store SessionStore `json:"-"` +// Id string `json:"id"` +// UserId string `json:"userId"` +// Status int32 `json:"status"` +// CreatedAt int64 `json:"createdAt"` +// Attributes map[string]string `json:"attributes"` +//} +// +//func (s *Session) GetWorkspace() string { +// if workspaceId, ok := s.Attributes[SESSION_WORKSPACE]; !ok { +// return constant.SYSTEM_WORKSPACE_DEFAULT +// } else { +// return workspaceId +// } +//} +// +//func (s *Session) SetWorkspace(workspaceId string) error { +// if workspaceId == constant.SYSTEM_WORKSPACE_DEFAULT { +// delete(s.Attributes, SESSION_WORKSPACE) +// } else { +// s.Attributes[SESSION_WORKSPACE] = workspaceId +// } +// return s.sync() +//} +// +//func (s *Session) IsDefaultWorkspace() bool { +// if workspaceId, ok := s.Attributes[SESSION_WORKSPACE]; !ok { +// return true +// } else { +// return workspaceId == constant.SYSTEM_WORKSPACE_DEFAULT +// } +//} +// +//func (s *Session) sync() error { +// if s.store == nil { +// return nil +// } +// if err := s.store.Update(s.ctx, s); err != nil { +// return err +// } +// return nil +//} diff --git a/server/common/session/store.go b/server/common/session/store.go index 7d926cbc..7fc5f6cc 100644 --- a/server/common/session/store.go +++ b/server/common/session/store.go @@ -1,110 +1,110 @@ package session -import ( - "context" - - "net/url" - "server/common/errors" - "server/common/redis" - - "github.com/go-kratos/kratos/v2/log" - redisLib "github.com/go-redis/redis/v8" - jsoniter "github.com/json-iterator/go" -) - -type SessionStore interface { - Create(ctx context.Context, session *Session) error - Get(ctx context.Context, sessionId string) (*Session, error) - Update(ctx context.Context, session *Session) error - Delete(ctx context.Context, sessionId string) error -} - -type SessionStoreConfig struct { - RedisAddr string - RedisUsername string - RedisPassword string - RedisDBIndex string -} - -func NewSessionStore(key string, config SessionStoreConfig, logger log.Logger) SessionStore { - logHelper := log.NewHelper("Session", logger) - - redisUrl := url.URL{ - Scheme: "redis", - Host: config.RedisAddr, - Path: config.RedisDBIndex, - User: url.UserPassword(config.RedisUsername, config.RedisPassword), - } - rdb, err := redis.GetRedisInstance(redisUrl.String()) - if err != nil { - panic(err) - } - - return &RemoteSessionStore{ - StoreKey: key, - config: config, - Instance: rdb, - logger: logHelper, - } -} - -type RemoteSessionStore struct { - StoreKey string - config SessionStoreConfig - Instance *redis.RedisInstance - logger *log.Helper -} - -func (s *RemoteSessionStore) Create(ctx context.Context, session *Session) error { - if session == nil || session.Id == "" { - return errors.Errorf(nil, errors.ErrorSessionIdNotFound) - } - sbytes, err := jsoniter.Marshal(&session) - if err != nil { - return errors.Errorf(err, errors.ErrorJsonMarshal) - } - - _, err = s.Instance.Redis.HSet(ctx, s.StoreKey, session.Id, sbytes).Result() - if err != nil { - return errors.Errorf(err, errors.ErroRedisHSetFailed) - } - return nil -} - -func (s *RemoteSessionStore) Get(ctx context.Context, sessionId string) (*Session, error) { - if sessionId == "" { - return nil, errors.Errorf(nil, errors.ErrorSessionIdNotFound) - } - resultStr, err := s.Instance.Redis.HGet(ctx, s.StoreKey, sessionId).Result() - if err != nil { - if redisLib.Nil == err { - return nil, nil - } - return nil, errors.Errorf(err, errors.ErroRedisHGetFailed) - } - - var session Session - err = jsoniter.Unmarshal([]byte(resultStr), &session) - if err != nil { - return nil, errors.Errorf(err, errors.ErrorJsonUnmarshal) - } - session.ctx = ctx - session.store = s - return &session, nil -} - -func (s *RemoteSessionStore) Update(ctx context.Context, session *Session) error { - return s.Create(ctx, session) -} - -func (s *RemoteSessionStore) Delete(ctx context.Context, sessionId string) error { - if sessionId == "" { - return errors.Errorf(nil, errors.ErrorSessionIdNotFound) - } - - _, err := s.Instance.Redis.HDel(ctx, s.StoreKey, sessionId).Result() - if err != nil { - return errors.Errorf(err, errors.ErroRedisHDelFailed) - } - return nil -} +//import ( +// "context" +// +// "net/url" +// "server/common/errors" +// "server/common/redis" +// +// "github.com/go-kratos/kratos/v2/log" +// redisLib "github.com/go-redis/redis/v8" +// jsoniter "github.com/json-iterator/go" +//) +// +//type SessionStore interface { +// Create(ctx context.Context, session *Session) error +// Get(ctx context.Context, sessionId string) (*Session, error) +// Update(ctx context.Context, session *Session) error +// Delete(ctx context.Context, sessionId string) error +//} +// +//type SessionStoreConfig struct { +// RedisAddr string +// RedisUsername string +// RedisPassword string +// RedisDBIndex string +//} +// +//func NewSessionStore(key string, config SessionStoreConfig, logger log.Logger) SessionStore { +// logHelper := log.NewHelper("Session", logger) +// +// redisUrl := url.URL{ +// Scheme: "redis", +// Host: config.RedisAddr, +// Path: config.RedisDBIndex, +// User: url.UserPassword(config.RedisUsername, config.RedisPassword), +// } +// rdb, err := redis.GetRedisInstance(redisUrl.String()) +// if err != nil { +// panic(err) +// } +// +// return &RemoteSessionStore{ +// StoreKey: key, +// config: config, +// Instance: rdb, +// logger: logHelper, +// } +//} +// +//type RemoteSessionStore struct { +// StoreKey string +// config SessionStoreConfig +// Instance *redis.RedisInstance +// logger *log.Helper +//} +// +//func (s *RemoteSessionStore) Create(ctx context.Context, session *Session) error { +// if session == nil || session.Id == "" { +// return errors.Errorf(nil, errors.ErrorSessionIdNotFound) +// } +// sbytes, err := jsoniter.Marshal(&session) +// if err != nil { +// return errors.Errorf(err, errors.ErrorJsonMarshal) +// } +// +// _, err = s.Instance.Redis.HSet(ctx, s.StoreKey, session.Id, sbytes).Result() +// if err != nil { +// return errors.Errorf(err, errors.ErroRedisHSetFailed) +// } +// return nil +//} +// +//func (s *RemoteSessionStore) Get(ctx context.Context, sessionId string) (*Session, error) { +// if sessionId == "" { +// return nil, errors.Errorf(nil, errors.ErrorSessionIdNotFound) +// } +// resultStr, err := s.Instance.Redis.HGet(ctx, s.StoreKey, sessionId).Result() +// if err != nil { +// if redisLib.Nil == err { +// return nil, nil +// } +// return nil, errors.Errorf(err, errors.ErroRedisHGetFailed) +// } +// +// var session Session +// err = jsoniter.Unmarshal([]byte(resultStr), &session) +// if err != nil { +// return nil, errors.Errorf(err, errors.ErrorJsonUnmarshal) +// } +// session.ctx = ctx +// session.store = s +// return &session, nil +//} +// +//func (s *RemoteSessionStore) Update(ctx context.Context, session *Session) error { +// return s.Create(ctx, session) +//} +// +//func (s *RemoteSessionStore) Delete(ctx context.Context, sessionId string) error { +// if sessionId == "" { +// return errors.Errorf(nil, errors.ErrorSessionIdNotFound) +// } +// +// _, err := s.Instance.Redis.HDel(ctx, s.StoreKey, sessionId).Result() +// if err != nil { +// return errors.Errorf(err, errors.ErroRedisHDelFailed) +// } +// return nil +//} diff --git a/server/common/sftpgo/v2/openapi/.gitignore b/server/common/sftpgo/v2/openapi/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/.gitignore @@ -0,0 +1,24 @@ +# 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/server/common/sftpgo/v2/openapi/.openapi-generator-ignore b/server/common/sftpgo/v2/openapi/.openapi-generator-ignore new file mode 100644 index 00000000..7484ee59 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/server/common/sftpgo/v2/openapi/.openapi-generator/FILES b/server/common/sftpgo/v2/openapi/.openapi-generator/FILES new file mode 100644 index 00000000..7777c3a2 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/.openapi-generator/FILES @@ -0,0 +1,216 @@ +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +api_admins.go +api_api_keys.go +api_connections.go +api_data_retention.go +api_defender.go +api_events.go +api_folders.go +api_healthcheck.go +api_maintenance.go +api_metadata.go +api_public_shares.go +api_quota.go +api_token.go +api_user_apis.go +api_users.go +client.go +configuration.go +docs/APIKeysApi.md +docs/Admin.md +docs/AdminFilters.md +docs/AdminPermissions.md +docs/AdminProfile.md +docs/AdminTOTPConfig.md +docs/AdminsApi.md +docs/ApiResponse.md +docs/AuthAPIKey.md +docs/AuthAPIKeyScope.md +docs/AzureBlobFsConfig.md +docs/BackupData.md +docs/BanStatus.md +docs/BandwidthLimit.md +docs/BaseTOTPConfig.md +docs/BaseVirtualFolder.md +docs/ConnectionStatus.md +docs/ConnectionsApi.md +docs/CryptFsConfig.md +docs/DataProviderStatus.md +docs/DataRetentionApi.md +docs/DataTransferLimit.md +docs/DefenderApi.md +docs/DefenderEntry.md +docs/DirEntry.md +docs/EventProtocols.md +docs/EventsApi.md +docs/FTPDBinding.md +docs/FTPPassivePortRange.md +docs/FTPServiceStatus.md +docs/FilesystemConfig.md +docs/FolderQuotaScan.md +docs/FolderRetention.md +docs/FoldersApi.md +docs/FsEvent.md +docs/FsEventAction.md +docs/FsEventStatus.md +docs/FsProviders.md +docs/GCSConfig.md +docs/HealthcheckApi.md +docs/HooksFilter.md +docs/InlineObject1.md +docs/InlineObject2.md +docs/InlineObject3.md +docs/InlineObject4.md +docs/InlineObject5.md +docs/InlineObject6.md +docs/InlineObject7.md +docs/InlineObject9.md +docs/InlineResponse200.md +docs/InlineResponse201.md +docs/LoginMethods.md +docs/MFAProtocols.md +docs/MFAStatus.md +docs/MaintenanceApi.md +docs/MetadataApi.md +docs/MetadataCheck.md +docs/PatternsFilter.md +docs/Permission.md +docs/ProviderEvent.md +docs/ProviderEventAction.md +docs/ProviderEventObjectType.md +docs/PublicSharesApi.md +docs/PwdChange.md +docs/QuotaApi.md +docs/QuotaScan.md +docs/QuotaUsage.md +docs/RecoveryCode.md +docs/RetentionCheck.md +docs/RetentionCheckNotification.md +docs/S3Config.md +docs/SFTPFsConfig.md +docs/SSHBinding.md +docs/SSHHostKey.md +docs/SSHServiceStatus.md +docs/ScoreStatus.md +docs/Secret.md +docs/ServicesStatus.md +docs/ServicesStatusDefender.md +docs/Share.md +docs/ShareScope.md +docs/SupportedProtocols.md +docs/TOTPConfig.md +docs/TOTPHMacAlgo.md +docs/Token.md +docs/TokenApi.md +docs/Transfer.md +docs/TransferQuotaUsage.md +docs/User.md +docs/UserAPIsApi.md +docs/UserFilters.md +docs/UserProfile.md +docs/UserTOTPConfig.md +docs/UserTOTPConfigAllOf.md +docs/UserType.md +docs/UsersApi.md +docs/VersionInfo.md +docs/VirtualFolder.md +docs/VirtualFolderAllOf.md +docs/WebClientOptions.md +docs/WebDAVBinding.md +docs/WebDAVServiceStatus.md +git_push.sh +go.mod +go.sum +model_admin.go +model_admin_filters.go +model_admin_permissions.go +model_admin_profile.go +model_admin_totp_config.go +model_api_response.go +model_auth_api_key.go +model_auth_api_key_scope.go +model_azure_blob_fs_config.go +model_backup_data.go +model_ban_status.go +model_bandwidth_limit.go +model_base_totp_config.go +model_base_virtual_folder.go +model_connection_status.go +model_crypt_fs_config.go +model_data_provider_status.go +model_data_transfer_limit.go +model_defender_entry.go +model_dir_entry.go +model_event_protocols.go +model_filesystem_config.go +model_folder_quota_scan.go +model_folder_retention.go +model_fs_event.go +model_fs_event_action.go +model_fs_event_status.go +model_fs_providers.go +model_ftp_passive_port_range.go +model_ftp_service_status.go +model_ftpd_binding.go +model_gcs_config.go +model_hooks_filter.go +model_inline_object_1.go +model_inline_object_2.go +model_inline_object_3.go +model_inline_object_4.go +model_inline_object_5.go +model_inline_object_6.go +model_inline_object_7.go +model_inline_object_9.go +model_inline_response_200.go +model_inline_response_201.go +model_login_methods.go +model_metadata_check.go +model_mfa_protocols.go +model_mfa_status.go +model_patterns_filter.go +model_permission.go +model_provider_event.go +model_provider_event_action.go +model_provider_event_object_type.go +model_pwd_change.go +model_quota_scan.go +model_quota_usage.go +model_recovery_code.go +model_retention_check.go +model_retention_check_notification.go +model_s3_config.go +model_score_status.go +model_secret.go +model_services_status.go +model_services_status_defender.go +model_sftpfs_config.go +model_share.go +model_share_scope.go +model_ssh_binding.go +model_ssh_host_key.go +model_ssh_service_status.go +model_supported_protocols.go +model_token.go +model_totp_config.go +model_totph_mac_algo.go +model_transfer.go +model_transfer_quota_usage.go +model_user.go +model_user_filters.go +model_user_profile.go +model_user_totp_config.go +model_user_totp_config_all_of.go +model_user_type.go +model_version_info.go +model_virtual_folder.go +model_virtual_folder_all_of.go +model_web_client_options.go +model_web_dav_binding.go +model_web_dav_service_status.go +response.go +utils.go diff --git a/server/common/sftpgo/v2/openapi/.openapi-generator/VERSION b/server/common/sftpgo/v2/openapi/.openapi-generator/VERSION new file mode 100644 index 00000000..1e20ec35 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.4.0 \ No newline at end of file diff --git a/server/common/sftpgo/v2/openapi/.travis.yml b/server/common/sftpgo/v2/openapi/.travis.yml new file mode 100644 index 00000000..f5cb2ce9 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/server/common/sftpgo/v2/openapi/README.md b/server/common/sftpgo/v2/openapi/README.md new file mode 100644 index 00000000..acd2e516 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/README.md @@ -0,0 +1,346 @@ +# Go API client for client + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. +Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. +SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. +Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. +SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 2.2.2-dev +- Package version: 3.1 +- Build package: org.openapitools.codegen.languages.GoClientCodegen +For more information, please visit [https://github.com/drakkan/sftpgo](https://github.com/drakkan/sftpgo) + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```golang +import client "github.com/hasusuf/sftpgo-client/client" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```golang +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. + +```golang +ctx := context.WithValue(context.Background(), client.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. + +```golang +ctx := context.WithValue(context.Background(), client.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. + +``` +ctx := context.WithValue(context.Background(), client.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), client.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to */api/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*APIKeysApi* | [**AddApiKey**](docs/APIKeysApi.md#addapikey) | **Post** /apikeys | Add API key +*APIKeysApi* | [**DeleteApiKey**](docs/APIKeysApi.md#deleteapikey) | **Delete** /apikeys/{id} | Delete API key +*APIKeysApi* | [**GetApiKeyById**](docs/APIKeysApi.md#getapikeybyid) | **Get** /apikeys/{id} | Find API key by id +*APIKeysApi* | [**GetApiKeys**](docs/APIKeysApi.md#getapikeys) | **Get** /apikeys | Get API keys +*APIKeysApi* | [**UpdateApiKey**](docs/APIKeysApi.md#updateapikey) | **Put** /apikeys/{id} | Update API key +*AdminsApi* | [**AddAdmin**](docs/AdminsApi.md#addadmin) | **Post** /admins | Add admin +*AdminsApi* | [**AdminForgotPassword**](docs/AdminsApi.md#adminforgotpassword) | **Post** /admins/{username}/forgot-password | Send a password reset code by email +*AdminsApi* | [**AdminResetPassword**](docs/AdminsApi.md#adminresetpassword) | **Post** /admins/{username}/reset-password | Reset the password +*AdminsApi* | [**ChangeAdminPassword**](docs/AdminsApi.md#changeadminpassword) | **Put** /admin/changepwd | Change admin password +*AdminsApi* | [**ChangeAdminPasswordDeprecated**](docs/AdminsApi.md#changeadminpassworddeprecated) | **Put** /changepwd/admin | Change admin password +*AdminsApi* | [**DeleteAdmin**](docs/AdminsApi.md#deleteadmin) | **Delete** /admins/{username} | Delete admin +*AdminsApi* | [**DisableAdmin2fa**](docs/AdminsApi.md#disableadmin2fa) | **Put** /admins/{username}/2fa/disable | Disable second factor authentication +*AdminsApi* | [**GenerateAdminRecoveryCodes**](docs/AdminsApi.md#generateadminrecoverycodes) | **Post** /admin/2fa/recoverycodes | Generate recovery codes +*AdminsApi* | [**GenerateAdminTotpSecret**](docs/AdminsApi.md#generateadmintotpsecret) | **Post** /admin/totp/generate | Generate a new TOTP secret +*AdminsApi* | [**GetAdminByUsername**](docs/AdminsApi.md#getadminbyusername) | **Get** /admins/{username} | Find admins by username +*AdminsApi* | [**GetAdminProfile**](docs/AdminsApi.md#getadminprofile) | **Get** /admin/profile | Get admin profile +*AdminsApi* | [**GetAdminRecoveryCodes**](docs/AdminsApi.md#getadminrecoverycodes) | **Get** /admin/2fa/recoverycodes | Get recovery codes +*AdminsApi* | [**GetAdminTotpConfigs**](docs/AdminsApi.md#getadmintotpconfigs) | **Get** /admin/totp/configs | Get available TOTP configuration +*AdminsApi* | [**GetAdmins**](docs/AdminsApi.md#getadmins) | **Get** /admins | Get admins +*AdminsApi* | [**SaveAdminTotpConfig**](docs/AdminsApi.md#saveadmintotpconfig) | **Post** /admin/totp/save | Save a TOTP config +*AdminsApi* | [**UpdateAdmin**](docs/AdminsApi.md#updateadmin) | **Put** /admins/{username} | Update admin +*AdminsApi* | [**UpdateAdminProfile**](docs/AdminsApi.md#updateadminprofile) | **Put** /admin/profile | Update admin profile +*AdminsApi* | [**ValidateAdminTotpSecret**](docs/AdminsApi.md#validateadmintotpsecret) | **Post** /admin/totp/validate | Validate a one time authentication code +*ConnectionsApi* | [**CloseConnection**](docs/ConnectionsApi.md#closeconnection) | **Delete** /connections/{connectionID} | Close connection +*ConnectionsApi* | [**GetConnections**](docs/ConnectionsApi.md#getconnections) | **Get** /connections | Get connections details +*DataRetentionApi* | [**GetUsersRetentionChecks**](docs/DataRetentionApi.md#getusersretentionchecks) | **Get** /retention/users/checks | Get retention checks +*DataRetentionApi* | [**StartUserRetentionCheck**](docs/DataRetentionApi.md#startuserretentioncheck) | **Post** /retention/users/{username}/check | Start a retention check +*DefenderApi* | [**DeleteDefenderHostById**](docs/DefenderApi.md#deletedefenderhostbyid) | **Delete** /defender/hosts/{id} | Removes a host from the defender lists +*DefenderApi* | [**GetBanTime**](docs/DefenderApi.md#getbantime) | **Get** /defender/bantime | Get ban time +*DefenderApi* | [**GetDefenderHostById**](docs/DefenderApi.md#getdefenderhostbyid) | **Get** /defender/hosts/{id} | Get host by id +*DefenderApi* | [**GetDefenderHosts**](docs/DefenderApi.md#getdefenderhosts) | **Get** /defender/hosts | Get hosts +*DefenderApi* | [**GetScore**](docs/DefenderApi.md#getscore) | **Get** /defender/score | Get score +*DefenderApi* | [**UnbanHost**](docs/DefenderApi.md#unbanhost) | **Post** /defender/unban | Unban +*EventsApi* | [**GetFsEvents**](docs/EventsApi.md#getfsevents) | **Get** /events/fs | Get filesystem events +*EventsApi* | [**GetProviderEvents**](docs/EventsApi.md#getproviderevents) | **Get** /events/provider | Get provider events +*FoldersApi* | [**AddFolder**](docs/FoldersApi.md#addfolder) | **Post** /folders | Add folder +*FoldersApi* | [**DeleteFolder**](docs/FoldersApi.md#deletefolder) | **Delete** /folders/{name} | Delete folder +*FoldersApi* | [**GetFolderByName**](docs/FoldersApi.md#getfolderbyname) | **Get** /folders/{name} | Find folders by name +*FoldersApi* | [**GetFolders**](docs/FoldersApi.md#getfolders) | **Get** /folders | Get folders +*FoldersApi* | [**UpdateFolder**](docs/FoldersApi.md#updatefolder) | **Put** /folders/{name} | Update folder +*HealthcheckApi* | [**Healthz**](docs/HealthcheckApi.md#healthz) | **Get** /healthz | health check +*MaintenanceApi* | [**Dumpdata**](docs/MaintenanceApi.md#dumpdata) | **Get** /dumpdata | Dump data +*MaintenanceApi* | [**GetStatus**](docs/MaintenanceApi.md#getstatus) | **Get** /status | Get status +*MaintenanceApi* | [**GetVersion**](docs/MaintenanceApi.md#getversion) | **Get** /version | Get version details +*MaintenanceApi* | [**LoaddataFromFile**](docs/MaintenanceApi.md#loaddatafromfile) | **Get** /loaddata | Load data from path +*MaintenanceApi* | [**LoaddataFromRequestBody**](docs/MaintenanceApi.md#loaddatafromrequestbody) | **Post** /loaddata | Load data +*MetadataApi* | [**GetUsersMetadataChecks**](docs/MetadataApi.md#getusersmetadatachecks) | **Get** /metadata/users/checks | Get metadata checks +*MetadataApi* | [**StartUserMetadataCheck**](docs/MetadataApi.md#startusermetadatacheck) | **Post** /metadata/users/{username}/check | Start a metadata check +*PublicSharesApi* | [**DownloadShareFile**](docs/PublicSharesApi.md#downloadsharefile) | **Get** /shares/{id}/files | Download a single file +*PublicSharesApi* | [**GetShare**](docs/PublicSharesApi.md#getshare) | **Get** /shares/{id} | Download shared files and folders as a single zip file +*PublicSharesApi* | [**GetShareDirContents**](docs/PublicSharesApi.md#getsharedircontents) | **Get** /shares/{id}/dirs | Read directory contents +*PublicSharesApi* | [**UploadSingleToShare**](docs/PublicSharesApi.md#uploadsingletoshare) | **Post** /shares/{id}/{fileName} | Upload a single file to the shared path +*PublicSharesApi* | [**UploadToShare**](docs/PublicSharesApi.md#uploadtoshare) | **Post** /shares/{id} | Upload one or more files to the shared path +*QuotaApi* | [**FolderQuotaUpdateUsage**](docs/QuotaApi.md#folderquotaupdateusage) | **Put** /quotas/folders/{name}/usage | Update folder quota usage limits +*QuotaApi* | [**FolderQuotaUpdateUsageDeprecated**](docs/QuotaApi.md#folderquotaupdateusagedeprecated) | **Put** /folder-quota-update | Update folder quota limits +*QuotaApi* | [**GetFoldersQuotaScans**](docs/QuotaApi.md#getfoldersquotascans) | **Get** /quotas/folders/scans | Get active folder quota scans +*QuotaApi* | [**GetFoldersQuotaScansDeprecated**](docs/QuotaApi.md#getfoldersquotascansdeprecated) | **Get** /folder-quota-scans | Get folders quota scans +*QuotaApi* | [**GetUsersQuotaScans**](docs/QuotaApi.md#getusersquotascans) | **Get** /quotas/users/scans | Get active user quota scans +*QuotaApi* | [**GetUsersQuotaScansDeprecated**](docs/QuotaApi.md#getusersquotascansdeprecated) | **Get** /quota-scans | Get quota scans +*QuotaApi* | [**StartFolderQuotaScan**](docs/QuotaApi.md#startfolderquotascan) | **Post** /quotas/folders/{name}/scan | Start a folder quota scan +*QuotaApi* | [**StartFolderQuotaScanDeprecated**](docs/QuotaApi.md#startfolderquotascandeprecated) | **Post** /folder-quota-scans | Start a folder quota scan +*QuotaApi* | [**StartUserQuotaScan**](docs/QuotaApi.md#startuserquotascan) | **Post** /quotas/users/{username}/scan | Start a user quota scan +*QuotaApi* | [**StartUserQuotaScanDeprecated**](docs/QuotaApi.md#startuserquotascandeprecated) | **Post** /quota-scans | Start user quota scan +*QuotaApi* | [**UserQuotaUpdateUsage**](docs/QuotaApi.md#userquotaupdateusage) | **Put** /quotas/users/{username}/usage | Update disk quota usage limits +*QuotaApi* | [**UserQuotaUpdateUsageDeprecated**](docs/QuotaApi.md#userquotaupdateusagedeprecated) | **Put** /quota-update | Update quota usage limits +*QuotaApi* | [**UserTransferQuotaUpdateUsage**](docs/QuotaApi.md#usertransferquotaupdateusage) | **Put** /quotas/users/{username}/transfer-usage | Update transfer quota usage limits +*TokenApi* | [**ClientLogout**](docs/TokenApi.md#clientlogout) | **Get** /user/logout | Invalidate a user access token +*TokenApi* | [**GetToken**](docs/TokenApi.md#gettoken) | **Get** /token | Get a new admin access token +*TokenApi* | [**GetUserToken**](docs/TokenApi.md#getusertoken) | **Get** /user/token | Get a new user access token +*TokenApi* | [**Logout**](docs/TokenApi.md#logout) | **Get** /logout | Invalidate an admin access token +*UserAPIsApi* | [**AddShare**](docs/UserAPIsApi.md#addshare) | **Post** /user/shares | Add a share +*UserAPIsApi* | [**ChangeUserPassword**](docs/UserAPIsApi.md#changeuserpassword) | **Put** /user/changepwd | Change user password +*UserAPIsApi* | [**CreateUserDir**](docs/UserAPIsApi.md#createuserdir) | **Post** /user/dirs | Create a directory +*UserAPIsApi* | [**CreateUserFile**](docs/UserAPIsApi.md#createuserfile) | **Post** /user/files/upload | Upload a single file +*UserAPIsApi* | [**CreateUserFiles**](docs/UserAPIsApi.md#createuserfiles) | **Post** /user/files | Upload files +*UserAPIsApi* | [**DeleteUserDir**](docs/UserAPIsApi.md#deleteuserdir) | **Delete** /user/dirs | Delete a directory +*UserAPIsApi* | [**DeleteUserFile**](docs/UserAPIsApi.md#deleteuserfile) | **Delete** /user/files | Delete a file +*UserAPIsApi* | [**DeleteUserShare**](docs/UserAPIsApi.md#deleteusershare) | **Delete** /user/shares/{id} | Delete share +*UserAPIsApi* | [**DownloadUserFile**](docs/UserAPIsApi.md#downloaduserfile) | **Get** /user/files | Download a single file +*UserAPIsApi* | [**GenerateUserRecoveryCodes**](docs/UserAPIsApi.md#generateuserrecoverycodes) | **Post** /user/2fa/recoverycodes | Generate recovery codes +*UserAPIsApi* | [**GenerateUserTotpSecret**](docs/UserAPIsApi.md#generateusertotpsecret) | **Post** /user/totp/generate | Generate a new TOTP secret +*UserAPIsApi* | [**GetUserDirContents**](docs/UserAPIsApi.md#getuserdircontents) | **Get** /user/dirs | Read directory contents +*UserAPIsApi* | [**GetUserFile**](docs/UserAPIsApi.md#getuserfile) | **Get** /user/file | Download a single file +*UserAPIsApi* | [**GetUserFolderContents**](docs/UserAPIsApi.md#getuserfoldercontents) | **Get** /user/folder | Read folders contents +*UserAPIsApi* | [**GetUserProfile**](docs/UserAPIsApi.md#getuserprofile) | **Get** /user/profile | Get user profile +*UserAPIsApi* | [**GetUserPublicKeys**](docs/UserAPIsApi.md#getuserpublickeys) | **Get** /user/publickeys | Get the user's public keys +*UserAPIsApi* | [**GetUserRecoveryCodes**](docs/UserAPIsApi.md#getuserrecoverycodes) | **Get** /user/2fa/recoverycodes | Get recovery codes +*UserAPIsApi* | [**GetUserShareById**](docs/UserAPIsApi.md#getusersharebyid) | **Get** /user/shares/{id} | Get share by id +*UserAPIsApi* | [**GetUserShares**](docs/UserAPIsApi.md#getusershares) | **Get** /user/shares | List user shares +*UserAPIsApi* | [**GetUserTotpConfigs**](docs/UserAPIsApi.md#getusertotpconfigs) | **Get** /user/totp/configs | Get available TOTP configuration +*UserAPIsApi* | [**RenameUserDir**](docs/UserAPIsApi.md#renameuserdir) | **Patch** /user/dirs | Rename a directory +*UserAPIsApi* | [**RenameUserFile**](docs/UserAPIsApi.md#renameuserfile) | **Patch** /user/files | Rename a file +*UserAPIsApi* | [**SaveUserTotpConfig**](docs/UserAPIsApi.md#saveusertotpconfig) | **Post** /user/totp/save | Save a TOTP config +*UserAPIsApi* | [**SetUserPublicKeys**](docs/UserAPIsApi.md#setuserpublickeys) | **Put** /user/publickeys | Set the user's public keys +*UserAPIsApi* | [**SetpropsUserFile**](docs/UserAPIsApi.md#setpropsuserfile) | **Patch** /user/files/metadata | Set metadata for a file/directory +*UserAPIsApi* | [**Streamzip**](docs/UserAPIsApi.md#streamzip) | **Post** /user/streamzip | Download multiple files and folders as a single zip file +*UserAPIsApi* | [**UpdateUserProfile**](docs/UserAPIsApi.md#updateuserprofile) | **Put** /user/profile | Update user profile +*UserAPIsApi* | [**UpdateUserShare**](docs/UserAPIsApi.md#updateusershare) | **Put** /user/shares/{id} | Update share +*UserAPIsApi* | [**ValidateUserTotpSecret**](docs/UserAPIsApi.md#validateusertotpsecret) | **Post** /user/totp/validate | Validate a one time authentication code +*UsersApi* | [**AddUser**](docs/UsersApi.md#adduser) | **Post** /users | Add user +*UsersApi* | [**DeleteUser**](docs/UsersApi.md#deleteuser) | **Delete** /users/{username} | Delete user +*UsersApi* | [**DisableUser2fa**](docs/UsersApi.md#disableuser2fa) | **Put** /users/{username}/2fa/disable | Disable second factor authentication +*UsersApi* | [**GetUserByUsername**](docs/UsersApi.md#getuserbyusername) | **Get** /users/{username} | Find users by username +*UsersApi* | [**GetUsers**](docs/UsersApi.md#getusers) | **Get** /users | Get users +*UsersApi* | [**UpdateUser**](docs/UsersApi.md#updateuser) | **Put** /users/{username} | Update user +*UsersApi* | [**UserForgotPassword**](docs/UsersApi.md#userforgotpassword) | **Post** /users/{username}/forgot-password | Send a password reset code by email +*UsersApi* | [**UserResetPassword**](docs/UsersApi.md#userresetpassword) | **Post** /users/{username}/reset-password | Reset the password + + +## Documentation For Models + + - [Admin](docs/Admin.md) + - [AdminFilters](docs/AdminFilters.md) + - [AdminPermissions](docs/AdminPermissions.md) + - [AdminProfile](docs/AdminProfile.md) + - [AdminTOTPConfig](docs/AdminTOTPConfig.md) + - [ApiResponse](docs/ApiResponse.md) + - [AuthAPIKey](docs/AuthAPIKey.md) + - [AuthAPIKeyScope](docs/AuthAPIKeyScope.md) + - [AzureBlobFsConfig](docs/AzureBlobFsConfig.md) + - [BackupData](docs/BackupData.md) + - [BanStatus](docs/BanStatus.md) + - [BandwidthLimit](docs/BandwidthLimit.md) + - [BaseTOTPConfig](docs/BaseTOTPConfig.md) + - [BaseVirtualFolder](docs/BaseVirtualFolder.md) + - [ConnectionStatus](docs/ConnectionStatus.md) + - [CryptFsConfig](docs/CryptFsConfig.md) + - [DataProviderStatus](docs/DataProviderStatus.md) + - [DataTransferLimit](docs/DataTransferLimit.md) + - [DefenderEntry](docs/DefenderEntry.md) + - [DirEntry](docs/DirEntry.md) + - [EventProtocols](docs/EventProtocols.md) + - [FTPDBinding](docs/FTPDBinding.md) + - [FTPPassivePortRange](docs/FTPPassivePortRange.md) + - [FTPServiceStatus](docs/FTPServiceStatus.md) + - [FilesystemConfig](docs/FilesystemConfig.md) + - [FolderQuotaScan](docs/FolderQuotaScan.md) + - [FolderRetention](docs/FolderRetention.md) + - [FsEvent](docs/FsEvent.md) + - [FsEventAction](docs/FsEventAction.md) + - [FsEventStatus](docs/FsEventStatus.md) + - [FsProviders](docs/FsProviders.md) + - [GCSConfig](docs/GCSConfig.md) + - [HooksFilter](docs/HooksFilter.md) + - [InlineObject1](docs/InlineObject1.md) + - [InlineObject2](docs/InlineObject2.md) + - [InlineObject3](docs/InlineObject3.md) + - [InlineObject4](docs/InlineObject4.md) + - [InlineObject5](docs/InlineObject5.md) + - [InlineObject6](docs/InlineObject6.md) + - [InlineObject7](docs/InlineObject7.md) + - [InlineObject9](docs/InlineObject9.md) + - [InlineResponse200](docs/InlineResponse200.md) + - [InlineResponse201](docs/InlineResponse201.md) + - [LoginMethods](docs/LoginMethods.md) + - [MFAProtocols](docs/MFAProtocols.md) + - [MFAStatus](docs/MFAStatus.md) + - [MetadataCheck](docs/MetadataCheck.md) + - [PatternsFilter](docs/PatternsFilter.md) + - [Permission](docs/Permission.md) + - [ProviderEvent](docs/ProviderEvent.md) + - [ProviderEventAction](docs/ProviderEventAction.md) + - [ProviderEventObjectType](docs/ProviderEventObjectType.md) + - [PwdChange](docs/PwdChange.md) + - [QuotaScan](docs/QuotaScan.md) + - [QuotaUsage](docs/QuotaUsage.md) + - [RecoveryCode](docs/RecoveryCode.md) + - [RetentionCheck](docs/RetentionCheck.md) + - [RetentionCheckNotification](docs/RetentionCheckNotification.md) + - [S3Config](docs/S3Config.md) + - [SFTPFsConfig](docs/SFTPFsConfig.md) + - [SSHBinding](docs/SSHBinding.md) + - [SSHHostKey](docs/SSHHostKey.md) + - [SSHServiceStatus](docs/SSHServiceStatus.md) + - [ScoreStatus](docs/ScoreStatus.md) + - [Secret](docs/Secret.md) + - [ServicesStatus](docs/ServicesStatus.md) + - [ServicesStatusDefender](docs/ServicesStatusDefender.md) + - [Share](docs/Share.md) + - [ShareScope](docs/ShareScope.md) + - [SupportedProtocols](docs/SupportedProtocols.md) + - [TOTPConfig](docs/TOTPConfig.md) + - [TOTPHMacAlgo](docs/TOTPHMacAlgo.md) + - [Token](docs/Token.md) + - [Transfer](docs/Transfer.md) + - [TransferQuotaUsage](docs/TransferQuotaUsage.md) + - [User](docs/User.md) + - [UserFilters](docs/UserFilters.md) + - [UserProfile](docs/UserProfile.md) + - [UserTOTPConfig](docs/UserTOTPConfig.md) + - [UserTOTPConfigAllOf](docs/UserTOTPConfigAllOf.md) + - [UserType](docs/UserType.md) + - [VersionInfo](docs/VersionInfo.md) + - [VirtualFolder](docs/VirtualFolder.md) + - [VirtualFolderAllOf](docs/VirtualFolderAllOf.md) + - [WebClientOptions](docs/WebClientOptions.md) + - [WebDAVBinding](docs/WebDAVBinding.md) + - [WebDAVServiceStatus](docs/WebDAVServiceStatus.md) + + +## Documentation For Authorization + + + +### APIKeyAuth + +- **Type**: API key +- **API key parameter name**: X-SFTPGO-API-KEY +- **Location**: HTTP header + +Note, each API key must be added to a map of `map[string]APIKey` where the key is: X-SFTPGO-API-KEY and passed in as the auth context for each request. + + +### BasicAuth + +- **Type**: HTTP basic authentication + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ + UserName: "username", + Password: "password", +}) +r, err := client.Service.Operation(auth, args) +``` + + +### BearerAuth + +- **Type**: HTTP Bearer token authentication + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING") +r, err := client.Service.Operation(auth, args) +``` + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + + + diff --git a/server/common/sftpgo/v2/openapi/api/openapi.yaml b/server/common/sftpgo/v2/openapi/api/openapi.yaml new file mode 100644 index 00000000..8e7a5187 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api/openapi.yaml @@ -0,0 +1,10437 @@ +openapi: 3.0.3 +info: + contact: + name: API support + url: https://github.com/drakkan/sftpgo + description: | + SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. + Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. + SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. + Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. + SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + license: + name: AGPLv3 + url: https://www.gnu.org/licenses/agpl-3.0.en.html + title: SFTPGo + version: 2.2.2-dev +servers: +- url: /api/v2 +security: +- BearerAuth: [] +- APIKeyAuth: [] +tags: +- name: healthcheck +- name: token +- name: maintenance +- name: admins +- name: API keys +- name: connections +- name: defender +- name: quota +- name: folders +- name: users +- name: data retention +- name: events +- name: metadata +- name: user APIs +- name: public shares +paths: + /healthz: + get: + description: This endpoint can be used to check if the application is running + and responding to requests + operationId: healthz + responses: + "200": + content: + text/plain: + schema: + example: ok + type: string + description: successful operation + security: [] + servers: + - url: / + summary: health check + tags: + - healthcheck + /shares/{id}: + get: + description: A zip file, containing the shared files and folders, will be generated + on the fly and returned as response body. Only folders and regular files will + be included in the zip. The share must be defined with the read scope and + the associated user must have list and download permissions + operationId: get_share + parameters: + - description: the share id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + - explode: true + in: query + name: compress + required: false + schema: + default: true + type: boolean + style: form + responses: + "200": + content: + '*/*': + schema: + format: binary + type: string + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BasicAuth: [] + summary: Download shared files and folders as a single zip file + tags: + - public shares + post: + description: The share must be defined with the write scope and the associated + user must have the upload permission + operationId: upload_to_share + parameters: + - description: the share id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object' + content: + multipart/form-data: + schema: + properties: + filenames: + items: + format: binary + type: string + minItems: 1 + type: array + uniqueItems: true + type: object + required: true + responses: + "201": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ApiResponse' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "413": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Request Entity Too Large, max allowed size exceeded + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BasicAuth: [] + summary: Upload one or more files to the shared path + tags: + - public shares + /shares/{id}/files: + get: + description: Returns the file contents as response body. The share must have + exactly one path defined and it must be a directory for this to work + operationId: download_share_file + parameters: + - description: the share id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + - description: Path to the file to download. It must be URL encoded, for example + the path "my dir/àdir/file.txt" must be sent as "my%20dir%2F%C3%A0dir%2Ffile.txt" + explode: true + in: query + name: path + required: true + schema: + type: string + style: form + - description: If set, the response will not have the Content-Disposition header + set to `attachment` + explode: true + in: query + name: inline + required: false + schema: + type: string + style: form + responses: + "200": + content: + '*/*': + schema: + format: binary + type: string + description: successful operation + "206": + content: + '*/*': + schema: + format: binary + type: string + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BasicAuth: [] + summary: Download a single file + tags: + - public shares + /shares/{id}/dirs: + get: + description: Returns the contents of the specified directory for the specified + share. The share must have exactly one path defined and it must be a directory + for this to work + operationId: get_share_dir_contents + parameters: + - description: the share id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + - description: Path to the folder to read. It must be URL encoded, for example + the path "my dir/àdir" must be sent as "my%20dir%2F%C3%A0dir". If empty + or missing the root folder is assumed + explode: true + in: query + name: path + required: false + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/DirEntry' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BasicAuth: [] + summary: Read directory contents + tags: + - public shares + /shares/{id}/{fileName}: + post: + description: The share must be defined with the write scope and the associated + user must have the upload/overwrite permissions + operationId: upload_single_to_share + parameters: + - description: the share id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + - description: the name of the new file. It must be path encoded. Sub directories + are not accepted + explode: false + in: path + name: fileName + required: true + schema: + type: string + style: simple + - description: File modification time as unix timestamp in milliseconds + explode: false + in: header + name: X-SFTPGO-MTIME + required: false + schema: + type: integer + style: simple + requestBody: + content: + application/*: + schema: + format: binary + type: string + text/*: + schema: + format: binary + type: string + image/*: + schema: + format: binary + type: string + audio/*: + schema: + format: binary + type: string + video/*: + schema: + format: binary + type: string + required: true + responses: + "201": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ApiResponse' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "413": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Request Entity Too Large, max allowed size exceeded + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BasicAuth: [] + summary: Upload a single file to the shared path + tags: + - public shares + /token: + get: + description: Returns an access token and its expiration + operationId: get_token + parameters: + - description: If you have 2FA configured for the admin attempting to log in + you need to set the authentication code using this header parameter + explode: false + in: header + name: X-SFTPGO-OTP + required: false + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Token' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BasicAuth: [] + summary: Get a new admin access token + tags: + - token + /logout: + get: + description: Allows to invalidate an admin token before its expiration + operationId: logout + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Invalidate an admin access token + tags: + - token + /user/token: + get: + description: Returns an access token and its expiration + operationId: get_user_token + parameters: + - description: If you have 2FA configured, for the HTTP protocol, for the user + attempting to log in you need to set the authentication code using this + header parameter + explode: false + in: header + name: X-SFTPGO-OTP + required: false + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Token' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BasicAuth: [] + summary: Get a new user access token + tags: + - token + /user/logout: + get: + description: Allows to invalidate a client token before its expiration + operationId: client_logout + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Invalidate a user access token + tags: + - token + /version: + get: + description: Returns version details such as the version number, build date, + commit hash and enabled features + operationId: get_version + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/VersionInfo' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get version details + tags: + - maintenance + /changepwd/admin: + put: + deprecated: true + description: Changes the password for the logged in admin. Please use '/admin/changepwd' + instead + operationId: change_admin_password_deprecated + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PwdChange' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Change admin password + tags: + - admins + /admin/changepwd: + put: + description: Changes the password for the logged in admin + operationId: change_admin_password + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PwdChange' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Change admin password + tags: + - admins + /admin/profile: + get: + description: Returns the profile for the logged in admin + operationId: get_admin_profile + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProfile' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Get admin profile + tags: + - admins + put: + description: Allows to update the profile for the logged in admin + operationId: update_admin_profile + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProfile' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Update admin profile + tags: + - admins + /admin/2fa/recoverycodes: + get: + description: Returns the recovery codes for the logged in admin. Recovery codes + can be used if the admin loses access to their second factor auth device. + Recovery codes are returned unencrypted + operationId: get_admin_recovery_codes + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/RecoveryCode' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Get recovery codes + tags: + - admins + post: + description: Generates new recovery codes for the logged in admin. Generating + new recovery codes you automatically invalidate old ones + operationId: generate_admin_recovery_codes + responses: + "200": + content: + application/json: + schema: + items: + type: string + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Generate recovery codes + tags: + - admins + /admin/totp/configs: + get: + description: Returns the available TOTP configurations for the logged in admin + operationId: get_admin_totp_configs + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TOTPConfig' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Get available TOTP configuration + tags: + - admins + /admin/totp/generate: + post: + description: Generates a new TOTP secret, including the QR code as png, using + the specified configuration for the logged in admin + operationId: generate_admin_totp_secret + requestBody: + $ref: '#/components/requestBodies/inline_object_1' + content: + application/json: + schema: + properties: + config_name: + description: name of the configuration to use to generate the secret + type: string + type: object + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Generate a new TOTP secret + tags: + - admins + /admin/totp/validate: + post: + description: Checks if the given authentication code can be validated using + the specified secret and config name + operationId: validate_admin_totp_secret + requestBody: + $ref: '#/components/requestBodies/inline_object_2' + content: + application/json: + schema: + properties: + config_name: + description: name of the configuration to use to validate the passcode + type: string + passcode: + description: passcode to validate + type: string + secret: + description: secret to use to validate the passcode + type: string + type: object + required: true + responses: + "200": + content: + application/json: + example: + message: Passcode successfully validated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Validate a one time authentication code + tags: + - admins + /admin/totp/save: + post: + description: Saves the specified TOTP config for the logged in admin + operationId: save_admin_totp_config + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminTOTPConfig' + required: true + responses: + "200": + content: + application/json: + example: + message: TOTP configuration saved + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Save a TOTP config + tags: + - admins + /connections: + get: + description: Returns the active users and info about their current uploads/downloads + operationId: get_connections + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ConnectionStatus' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get connections details + tags: + - connections + /connections/{connectionID}: + delete: + description: Terminates an active connection + operationId: close_connection + parameters: + - description: ID of the connection to close + explode: false + in: path + name: connectionID + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + message: Connection closed + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Close connection + tags: + - connections + /defender/hosts: + get: + description: Returns hosts that are banned or for which some violations have + been detected + operationId: get_defender_hosts + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/DefenderEntry' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get hosts + tags: + - defender + /defender/hosts/{id}: + delete: + description: Unbans the specified host or clears its violations + operationId: delete_defender_host_by_id + parameters: + - description: host id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Removes a host from the defender lists + tags: + - defender + get: + description: Returns the host with the given id, if it exists + operationId: get_defender_host_by_id + parameters: + - description: host id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DefenderEntry' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get host by id + tags: + - defender + /defender/bantime: + get: + deprecated: true + description: Deprecated, please use '/defender/hosts', '/defender/hosts/{id}' + instead + operationId: get_ban_time + parameters: + - description: IPv4/IPv6 address + explode: true + in: query + name: ip + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BanStatus' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get ban time + tags: + - defender + /defender/unban: + post: + deprecated: true + description: Deprecated, please use '/defender/hosts/{id}' instead + operationId: unban_host + requestBody: + $ref: '#/components/requestBodies/inline_object_3' + content: + application/json: + schema: + properties: + ip: + description: IPv4/IPv6 address to remove + type: string + type: object + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Unban + tags: + - defender + /defender/score: + get: + deprecated: true + description: Deprecated, please use '/defender/hosts', '/defender/hosts/{id}' + instead + operationId: get_score + parameters: + - description: IPv4/IPv6 address + explode: true + in: query + name: ip + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ScoreStatus' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get score + tags: + - defender + /metadata/users/checks: + get: + description: Returns the active metadata checks + operationId: get_users_metadata_checks + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/MetadataCheck' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get metadata checks + tags: + - metadata + /metadata/users/{username}/check: + post: + description: Starts a new metadata check for the given user. A metadata check + requires a metadata plugin and removes the metadata associated to missing + items (for example objects deleted outside SFTPGo). If a metadata check for + this user is already active a 409 status code is returned. Metadata are stored + for cloud storage backends. This API does nothing for other backends or if + no metadata plugin is configured + operationId: start_user_metadata_check + parameters: + - description: the username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "202": + content: + application/json: + example: + message: Check started + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Conflict + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Start a metadata check + tags: + - metadata + /retention/users/checks: + get: + description: Returns the active retention checks + operationId: get_users_retention_checks + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/RetentionCheck' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get retention checks + tags: + - data retention + /retention/users/{username}/check: + post: + description: Starts a new retention check for the given user. If a retention + check for this user is already active a 409 status code is returned + operationId: start_user_retention_check + parameters: + - description: the username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + - description: specify how to notify results + explode: false + in: query + name: notifications + required: false + schema: + items: + $ref: '#/components/schemas/RetentionCheckNotification' + type: array + style: form + requestBody: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/FolderRetention' + type: array + description: Defines virtual paths to check and their retention time in hours + required: true + responses: + "202": + content: + application/json: + example: + message: Check started + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Conflict + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Start a retention check + tags: + - data retention + /quotas/users/scans: + get: + description: Returns the active user quota scans + operationId: get_users_quota_scans + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/QuotaScan' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get active user quota scans + tags: + - quota + /quotas/users/{username}/scan: + post: + description: Starts a new quota scan for the given user. A quota scan updates + the number of files and their total size for the specified user and the virtual + folders, if any, included in his quota + operationId: start_user_quota_scan + parameters: + - description: the username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "202": + content: + application/json: + example: + message: Scan started + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Conflict + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Start a user quota scan + tags: + - quota + /quotas/users/{username}/usage: + put: + description: Sets the current used quota limits for the given user + operationId: user_quota_update_usage + parameters: + - description: the username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + - description: the update mode specifies if the given quota usage values should + be added or replace the current ones + explode: true + in: query + name: mode + required: false + schema: + description: | + Update type: + * `add` - add the specified quota limits to the current used ones + * `reset` - reset the values to the specified ones. This is the default + enum: + - add + - reset + example: reset + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/QuotaUsage' + description: If used_quota_size and used_quota_files are missing they will + default to 0, this means that if mode is "add" the current value, for the + missing field, will remain unchanged, if mode is "reset" the missing field + is set to 0 + required: true + responses: + "200": + content: + application/json: + example: + message: Quota updated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Conflict + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Update disk quota usage limits + tags: + - quota + /quotas/users/{username}/transfer-usage: + put: + description: Sets the current used transfer quota limits for the given user + operationId: user_transfer_quota_update_usage + parameters: + - description: the username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + - description: the update mode specifies if the given quota usage values should + be added or replace the current ones + explode: true + in: query + name: mode + required: false + schema: + description: | + Update type: + * `add` - add the specified quota limits to the current used ones + * `reset` - reset the values to the specified ones. This is the default + enum: + - add + - reset + example: reset + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TransferQuotaUsage' + description: If used_upload_data_transfer and used_download_data_transfer + are missing they will default to 0, this means that if mode is "add" the + current value, for the missing field, will remain unchanged, if mode is + "reset" the missing field is set to 0 + required: true + responses: + "200": + content: + application/json: + example: + message: Quota updated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Conflict + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Update transfer quota usage limits + tags: + - quota + /quotas/folders/scans: + get: + description: Returns the active folder quota scans + operationId: get_folders_quota_scans + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/FolderQuotaScan' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get active folder quota scans + tags: + - quota + /quotas/folders/{name}/scan: + post: + description: Starts a new quota scan for the given folder. A quota scan update + the number of files and their total size for the specified folder + operationId: start_folder_quota_scan + parameters: + - description: folder name + explode: false + in: path + name: name + required: true + schema: + type: string + style: simple + responses: + "202": + content: + application/json: + example: + message: Scan started + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Conflict + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Start a folder quota scan + tags: + - quota + /quotas/folders/{name}/usage: + put: + description: Sets the current used quota limits for the given folder + operationId: folder_quota_update_usage + parameters: + - description: folder name + explode: false + in: path + name: name + required: true + schema: + type: string + style: simple + - description: the update mode specifies if the given quota usage values should + be added or replace the current ones + explode: true + in: query + name: mode + required: false + schema: + description: | + Update type: + * `add` - add the specified quota limits to the current used ones + * `reset` - reset the values to the specified ones. This is the default + enum: + - add + - reset + example: reset + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/QuotaUsage' + description: If used_quota_size and used_quota_files are missing they will + default to 0, this means that if mode is "add" the current value, for the + missing field, will remain unchanged, if mode is "reset" the missing field + is set to 0 + required: true + responses: + "200": + content: + application/json: + example: + message: Quota updated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Conflict + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Update folder quota usage limits + tags: + - quota + /quota-scans: + get: + deprecated: true + description: Deprecated, please use '/quotas/users/scans' instead + operationId: get_users_quota_scans_deprecated + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/QuotaScan' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get quota scans + tags: + - quota + post: + deprecated: true + description: Deprecated, please use '/quotas/users/{username}/scan' instead + operationId: start_user_quota_scan_deprecated + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + "202": + content: + application/json: + example: + message: Scan started + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Conflict + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Start user quota scan + tags: + - quota + /quota-update: + put: + deprecated: true + description: Deprecated, please use '/quotas/users/{username}/usage' instead + operationId: user_quota_update_usage_deprecated + parameters: + - description: the update mode specifies if the given quota usage values should + be added or replace the current ones + explode: true + in: query + name: mode + required: false + schema: + description: | + Update type: + * `add` - add the specified quota limits to the current used ones + * `reset` - reset the values to the specified ones. This is the default + enum: + - add + - reset + example: reset + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: The only user mandatory fields are username, used_quota_size + and used_quota_files. Please note that if the quota fields are missing they + will default to 0, this means that if mode is "add" the current value will + remain unchanged, if mode is "reset" the missing field is set to 0 + required: true + responses: + "200": + content: + application/json: + example: + message: Quota updated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Update quota usage limits + tags: + - quota + /folder-quota-update: + put: + deprecated: true + description: Deprecated, please use '/quotas/folders/{name}/usage' instead + operationId: folder_quota_update_usage_deprecated + parameters: + - description: the update mode specifies if the given quota usage values should + be added or replace the current ones + explode: true + in: query + name: mode + required: false + schema: + description: | + Update type: + * `add` - add the specified quota limits to the current used ones + * `reset` - reset the values to the specified ones. This is the default + enum: + - add + - reset + example: reset + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BaseVirtualFolder' + description: The only folder mandatory fields are mapped_path,used_quota_size + and used_quota_files. Please note that if the used quota fields are missing + they will default to 0, this means that if mode is "add" the current value + will remain unchanged, if mode is "reset" the missing field is set to 0 + required: true + responses: + "200": + content: + application/json: + example: + message: Quota updated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Update folder quota limits + tags: + - quota + /folder-quota-scans: + get: + deprecated: true + description: Deprecated, please use '/quotas/folders/scans' instead + operationId: get_folders_quota_scans_deprecated + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/FolderQuotaScan' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get folders quota scans + tags: + - quota + post: + deprecated: true + description: Deprecated, please use '/quotas/folders/{name}/scan' instead + operationId: start_folder_quota_scan_deprecated + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BaseVirtualFolder' + required: true + responses: + "202": + content: + application/json: + example: + message: Scan started + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Conflict + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Start a folder quota scan + tags: + - quota + /folders: + get: + description: Returns an array with one or more folders + operationId: get_folders + parameters: + - explode: true + in: query + name: offset + required: false + schema: + default: 0 + minimum: 0 + type: integer + style: form + - description: The maximum number of items to return. Max value is 500, default + is 100 + explode: true + in: query + name: limit + required: false + schema: + default: 100 + maximum: 500 + minimum: 1 + type: integer + style: form + - description: Ordering folders by path. Default ASC + explode: true + in: query + name: order + required: false + schema: + enum: + - ASC + - DESC + example: ASC + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/BaseVirtualFolder' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get folders + tags: + - folders + post: + description: Adds a new folder. A quota scan is required to update the used + files/size + operationId: add_folder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BaseVirtualFolder' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/BaseVirtualFolder' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Add folder + tags: + - folders + /folders/{name}: + delete: + description: Deletes an existing folder + operationId: delete_folder + parameters: + - description: folder name + explode: false + in: path + name: name + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + message: User deleted + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Delete folder + tags: + - folders + get: + description: Returns the folder with the given name if it exists. + operationId: get_folder_by_name + parameters: + - description: folder name + explode: false + in: path + name: name + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BaseVirtualFolder' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Find folders by name + tags: + - folders + put: + description: Updates an existing folder + operationId: update_folder + parameters: + - description: folder name + explode: false + in: path + name: name + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BaseVirtualFolder' + required: true + responses: + "200": + content: + application/json: + example: + message: User updated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Update folder + tags: + - folders + /events/fs: + get: + description: Returns an array with one or more filesystem events applying the + specified filters. This API is only available if you configure an "eventsearcher" + plugin + operationId: get_fs_events + parameters: + - description: the event timestamp, unix timestamp in nanoseconds, must be greater + than or equal to the specified one. 0 or missing means omit this filter + explode: true + in: query + name: start_timestamp + required: false + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + style: form + - description: the event timestamp, unix timestamp in nanoseconds, must be less + than or equal to the specified one. 0 or missing means omit this filter + explode: true + in: query + name: end_timestamp + required: false + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + style: form + - description: the event action must be included among those specified. Empty + or missing means omit this filter. Actions must be specified comma separated + explode: false + in: query + name: actions + required: false + schema: + items: + $ref: '#/components/schemas/FsEventAction' + type: array + style: form + - description: the event username must be the same as the one specified. Empty + or missing means omit this filter + explode: true + in: query + name: username + required: false + schema: + type: string + style: form + - description: the event IP must be the same as the one specified. Empty or + missing means omit this filter + explode: true + in: query + name: ip + required: false + schema: + type: string + style: form + - description: the event SSH command must be the same as the one specified. + Empty or missing means omit this filter + explode: true + in: query + name: ssh_cmd + required: false + schema: + type: string + style: form + - description: the event filesystem provider must be the same as the one specified. + Empty or missing means omit this filter + explode: true + in: query + name: fs_provider + required: false + schema: + $ref: '#/components/schemas/FsProviders' + style: form + - description: the bucket must be the same as the one specified. Empty or missing + means omit this filter + explode: true + in: query + name: bucket + required: false + schema: + type: string + style: form + - description: the endpoint must be the same as the one specified. Empty or + missing means omit this filter + explode: true + in: query + name: endpoint + required: false + schema: + type: string + style: form + - description: the event protocol must be included among those specified. Empty + or missing means omit this filter. Values must be specified comma separated + explode: false + in: query + name: protocols + required: false + schema: + items: + $ref: '#/components/schemas/EventProtocols' + type: array + style: form + - description: the event status must be included among those specified. Empty + or missing means omit this filter. Values must be specified comma separated + explode: false + in: query + name: statuses + required: false + schema: + items: + $ref: '#/components/schemas/FsEventStatus' + type: array + style: form + - description: the event instance id must be included among those specified. + Empty or missing means omit this filter. Values must be specified comma + separated + explode: false + in: query + name: instance_ids + required: false + schema: + items: + type: string + type: array + style: form + - description: the event id must not be included among those specified. This + is useful for cursor based pagination. Empty or missing means omit this + filter. Values must be specified comma separated + explode: false + in: query + name: exclude_ids + required: false + schema: + items: + type: string + type: array + style: form + - description: The maximum number of items to return. Max value is 500, default + is 100 + explode: true + in: query + name: limit + required: false + schema: + default: 100 + maximum: 1000 + minimum: 1 + type: integer + style: form + - description: Ordering events by timestamp. Default DESC + explode: true + in: query + name: order + required: false + schema: + enum: + - ASC + - DESC + example: DESC + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/FsEvent' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get filesystem events + tags: + - events + /events/provider: + get: + description: Returns an array with one or more provider events applying the + specified filters. This API is only available if you configure an "eventsearcher" + plugin + operationId: get_provider_events + parameters: + - description: the event timestamp, unix timestamp in nanoseconds, must be greater + than or equal to the specified one. 0 or missing means omit this filter + explode: true + in: query + name: start_timestamp + required: false + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + style: form + - description: the event timestamp, unix timestamp in nanoseconds, must be less + than or equal to the specified one. 0 or missing means omit this filter + explode: true + in: query + name: end_timestamp + required: false + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + style: form + - description: the event action must be included among those specified. Empty + or missing means omit this filter. Actions must be specified comma separated + explode: false + in: query + name: actions + required: false + schema: + items: + $ref: '#/components/schemas/ProviderEventAction' + type: array + style: form + - description: the event username must be the same as the one specified. Empty + or missing means omit this filter + explode: true + in: query + name: username + required: false + schema: + type: string + style: form + - description: the event IP must be the same as the one specified. Empty or + missing means omit this filter + explode: true + in: query + name: ip + required: false + schema: + type: string + style: form + - description: the event object name must be the same as the one specified. + Empty or missing means omit this filter + explode: true + in: query + name: object_name + required: false + schema: + type: string + style: form + - description: the event object type must be included among those specified. + Empty or missing means omit this filter. Values must be specified comma + separated + explode: false + in: query + name: object_types + required: false + schema: + items: + $ref: '#/components/schemas/ProviderEventObjectType' + type: array + style: form + - description: the event instance id must be included among those specified. + Empty or missing means omit this filter. Values must be specified comma + separated + explode: false + in: query + name: instance_ids + required: false + schema: + items: + type: string + type: array + style: form + - description: the event id must not be included among those specified. This + is useful for cursor based pagination. Empty or missing means omit this + filter. Values must be specified comma separated + explode: false + in: query + name: exclude_ids + required: false + schema: + items: + type: string + type: array + style: form + - description: The maximum number of items to return. Max value is 500, default + is 100 + explode: true + in: query + name: limit + required: false + schema: + default: 100 + maximum: 1000 + minimum: 1 + type: integer + style: form + - description: Ordering events by timestamp. Default DESC + explode: true + in: query + name: order + required: false + schema: + enum: + - ASC + - DESC + example: DESC + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ProviderEvent' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get provider events + tags: + - events + /apikeys: + get: + description: Returns an array with one or more API keys. For security reasons + hashed keys are omitted in the response + operationId: get_api_keys + parameters: + - explode: true + in: query + name: offset + required: false + schema: + default: 0 + minimum: 0 + type: integer + style: form + - description: The maximum number of items to return. Max value is 500, default + is 100 + explode: true + in: query + name: limit + required: false + schema: + default: 100 + maximum: 500 + minimum: 1 + type: integer + style: form + - description: Ordering API keys by id. Default ASC + explode: true + in: query + name: order + required: false + schema: + enum: + - ASC + - DESC + example: ASC + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/AuthAPIKey' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Get API keys + tags: + - API keys + post: + description: Adds a new API key + operationId: add_api_key + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AuthAPIKey' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_201' + description: successful operation + headers: + X-Object-ID: + description: ID for the new created API key + explode: false + schema: + type: string + style: simple + Location: + description: URL to retrieve the details for the new created API key + explode: false + schema: + type: string + style: simple + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Add API key + tags: + - API keys + /apikeys/{id}: + delete: + description: Deletes an existing API key + operationId: delete_api_key + parameters: + - description: the key id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + message: Admin deleted + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Delete API key + tags: + - API keys + get: + description: Returns the API key with the given id, if it exists. For security + reasons the hashed key is omitted in the response + operationId: get_api_key_by_id + parameters: + - description: the key id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AuthAPIKey' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Find API key by id + tags: + - API keys + put: + description: Updates an existing API key. You cannot update the key itself, + the creation date and the last use + operationId: update_api_key + parameters: + - description: the key id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AuthAPIKey' + required: true + responses: + "200": + content: + application/json: + example: + message: API key updated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Update API key + tags: + - API keys + /admins: + get: + description: Returns an array with one or more admins. For security reasons + hashed passwords are omitted in the response + operationId: get_admins + parameters: + - explode: true + in: query + name: offset + required: false + schema: + default: 0 + minimum: 0 + type: integer + style: form + - description: The maximum number of items to return. Max value is 500, default + is 100 + explode: true + in: query + name: limit + required: false + schema: + default: 100 + maximum: 500 + minimum: 1 + type: integer + style: form + - description: Ordering admins by username. Default ASC + explode: true + in: query + name: order + required: false + schema: + enum: + - ASC + - DESC + example: ASC + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Admin' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get admins + tags: + - admins + post: + description: 'Adds a new admin. Recovery codes and TOTP configuration cannot + be set using this API: each admin must use the specific APIs' + operationId: add_admin + requestBody: + content: + application/json: + examples: + example-1: + value: + id: 1 + status: 0 + username: string + description: string + password: pa$$word + email: user@example.com + permissions: + - '*' + filters: + allow_list: + - 192.0.2.0/24 + - 2001:db8::/32 + additional_info: string + schema: + $ref: '#/components/schemas/Admin' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/Admin' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Add admin + tags: + - admins + /admins/{username}: + delete: + description: Deletes an existing admin + operationId: delete_admin + parameters: + - description: the admin username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + message: Admin deleted + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Delete admin + tags: + - admins + get: + description: Returns the admin with the given username, if it exists. For security + reasons the hashed password is omitted in the response + operationId: get_admin_by_username + parameters: + - description: the admin username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Admin' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Find admins by username + tags: + - admins + put: + description: 'Updates an existing admin. Recovery codes and TOTP configuration + cannot be set/updated using this API: each admin must use the specific APIs. + You are not allowed to update the admin impersonated using an API key' + operationId: update_admin + parameters: + - description: the admin username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Admin' + required: true + responses: + "200": + content: + application/json: + example: + message: Admin updated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Update admin + tags: + - admins + /admins/{username}/2fa/disable: + put: + description: Disables second factor authentication for the given admin. This + API must be used if the admin loses access to their second factor auth device + and has no recovery codes + operationId: disable_admin_2fa + parameters: + - description: the admin username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + message: 2FA disabled + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Disable second factor authentication + tags: + - admins + /admins/{username}/forgot-password: + post: + description: You must set up an SMTP server and the account must have a valid + email address, in which case SFTPGo will send a code via email to reset the + password. If the specified admin does not exist, the request will be silently + ignored (a success response will be returned) to avoid disclosing existing + admins + operationId: admin_forgot_password + parameters: + - description: the admin username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: [] + summary: Send a password reset code by email + tags: + - admins + /admins/{username}/reset-password: + post: + description: Set a new password using the code received via email + operationId: admin_reset_password + parameters: + - description: the admin username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object_4' + content: + application/json: + schema: + properties: + code: + type: string + password: + type: string + type: object + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: [] + summary: Reset the password + tags: + - admins + /users: + get: + description: Returns an array with one or more users. For security reasons hashed + passwords are omitted in the response + operationId: get_users + parameters: + - explode: true + in: query + name: offset + required: false + schema: + default: 0 + minimum: 0 + type: integer + style: form + - description: The maximum number of items to return. Max value is 500, default + is 100 + explode: true + in: query + name: limit + required: false + schema: + default: 100 + maximum: 500 + minimum: 1 + type: integer + style: form + - description: Ordering users by username. Default ASC + explode: true + in: query + name: order + required: false + schema: + enum: + - ASC + - DESC + example: ASC + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get users + tags: + - users + post: + description: 'Adds a new user.Recovery codes and TOTP configuration cannot be + set using this API: each user must use the specific APIs' + operationId: add_user + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Add user + tags: + - users + /users/{username}: + delete: + description: Deletes an existing user + operationId: delete_user + parameters: + - description: the username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + message: User deleted + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Delete user + tags: + - users + get: + description: Returns the user with the given username if it exists. For security + reasons the hashed password is omitted in the response + operationId: get_user_by_username + parameters: + - description: the username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Find users by username + tags: + - users + put: + description: 'Updates an existing user and optionally disconnects it, if connected, + to apply the new settings. Recovery codes and TOTP configuration cannot be + set/updated using this API: each user must use the specific APIs' + operationId: update_user + parameters: + - description: the username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + - description: | + Disconnect: + * `0` The user will not be disconnected and it will continue to use the old configuration until connected. This is the default + * `1` The user will be disconnected after a successful update. It must login again and so it will be forced to use the new configuration + explode: true + in: query + name: disconnect + required: false + schema: + enum: + - 0 + - 1 + type: integer + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + "200": + content: + application/json: + example: + message: User updated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Update user + tags: + - users + /users/{username}/2fa/disable: + put: + description: Disables second factor authentication for the given user. This + API must be used if the user loses access to their second factor auth device + and has no recovery codes + operationId: disable_user_2fa + parameters: + - description: the username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + message: 2FA disabled + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Disable second factor authentication + tags: + - users + /users/{username}/forgot-password: + post: + description: You must configure an SMTP server, the account must have a valid + email address and must not have the "reset-password-disabled" restriction, + in which case SFTPGo will send a code via email to reset the password. If + the specified user does not exist, the request will be silently ignored (a + success response will be returned) to avoid disclosing existing users + operationId: user_forgot_password + parameters: + - description: the username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: [] + summary: Send a password reset code by email + tags: + - users + /users/{username}/reset-password: + post: + description: Set a new password using the code received via email + operationId: user_reset_password + parameters: + - description: the username + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object_5' + content: + application/json: + schema: + properties: + code: + type: string + password: + type: string + type: object + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: [] + summary: Reset the password + tags: + - users + /status: + get: + description: Retrieves the status of the active services + operationId: get_status + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ServicesStatus' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get status + tags: + - maintenance + /dumpdata: + get: + description: Backups data as data provider independent JSON. The backup can + be saved in a local file on the server, to avoid exposing sensitive data over + the network, or returned as response body. The output of dumpdata can be used + as input for loaddata + operationId: dumpdata + parameters: + - description: Path for the file to write the JSON serialized data to. This + path is relative to the configured "backups_path". If this file already + exists it will be overwritten. To return the backup as response body set + `output_data` to true instead. + explode: true + in: query + name: output-file + required: false + schema: + type: string + style: form + - description: | + output data: + * `0` or any other value != 1, the backup will be saved to a file on the server, `output_file` is required + * `1` the backup will be returned as response body + explode: true + in: query + name: output-data + required: false + schema: + enum: + - 0 + - 1 + type: integer + style: form + - description: | + indent: + * `0` no indentation. This is the default + * `1` format the output JSON + explode: true + in: query + name: indent + required: false + schema: + enum: + - 0 + - 1 + type: integer + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BackupData' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Dump data + tags: + - maintenance + /loaddata: + get: + description: Restores SFTPGo data from a JSON backup file on the server. Objects + will be restored one by one and the restore is stopped if a object cannot + be added or updated, so it could happen a partial restore + operationId: loaddata_from_file + parameters: + - description: | + Quota scan: + * `0` no quota scan is done, the imported users/folders will have used_quota_size and used_quota_files = 0 or the existing values if they already exists. This is the default + * `1` scan quota + * `2` scan quota if the user has quota restrictions + required: false + explode: true + in: query + name: scan-quota + required: false + schema: + enum: + - 0 + - 1 + - 2 + type: integer + style: form + - description: | + Mode: + * `0` New objects are added, existing ones are updated. This is the default + * `1` New objects are added, existing ones are not modified + * `2` New objects are added, existing ones are updated and connected users are disconnected and so forced to use the new configuration + explode: true + in: query + name: mode + required: false + schema: + enum: + - 0 + - 1 + - 2 + type: integer + style: form + - description: Path for the file to read the JSON serialized data from. This + can be an absolute path or a path relative to the configured "backups_path". + The max allowed file size is 10MB + explode: true + in: query + name: input-file + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/json: + example: + message: Data restored + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Load data from path + tags: + - maintenance + post: + description: Restores SFTPGo data from a JSON backup. Objects will be restored + one by one and the restore is stopped if a object cannot be added or updated, + so it could happen a partial restore + operationId: loaddata_from_request_body + parameters: + - description: | + Quota scan: + * `0` no quota scan is done, the imported users/folders will have used_quota_size and used_quota_files = 0 or the existing values if they already exists. This is the default + * `1` scan quota + * `2` scan quota if the user has quota restrictions + required: false + explode: true + in: query + name: scan-quota + required: false + schema: + enum: + - 0 + - 1 + - 2 + type: integer + style: form + - description: | + Mode: + * `0` New objects are added, existing ones are updated. This is the default + * `1` New objects are added, existing ones are not modified + * `2` New objects are added, existing ones are updated and connected users are disconnected and so forced to use the new configuration + explode: true + in: query + name: mode + required: false + schema: + enum: + - 0 + - 1 + - 2 + type: integer + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BackupData' + required: true + responses: + "200": + content: + application/json: + example: + message: Data restored + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Load data + tags: + - maintenance + /user/changepwd: + put: + description: Changes the password for the logged in user + operationId: change_user_password + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PwdChange' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Change user password + tags: + - user APIs + /user/publickeys: + get: + deprecated: true + description: Returns the public keys for the logged in user. Deprecated please + use "/user/profile" instead + operationId: get_user_public_keys + responses: + "200": + content: + application/json: + schema: + items: + type: string + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Get the user's public keys + tags: + - user APIs + put: + deprecated: true + description: Sets the public keys for the logged in user. Public keys must be + in OpenSSH format. Deprecated please use "/user/profile" instead + operationId: set_user_public_keys + requestBody: + content: + application/json: + schema: + items: + description: Public key in OpenSSH format + example: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPVILdH2u3yV5SAeE6XksD1z1vXRg0E4hJUov8ITDAZ2 + user@host + type: string + type: array + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Set the user's public keys + tags: + - user APIs + /user/profile: + get: + description: Returns the profile for the logged in user + operationId: get_user_profile + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/UserProfile' + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Get user profile + tags: + - user APIs + put: + description: Allows to update the profile for the logged in user + operationId: update_user_profile + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UserProfile' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Update user profile + tags: + - user APIs + /user/2fa/recoverycodes: + get: + description: Returns the recovery codes for the logged in user. Recovery codes + can be used if the user loses access to their second factor auth device. Recovery + codes are returned unencrypted + operationId: get_user_recovery_codes + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/RecoveryCode' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Get recovery codes + tags: + - user APIs + post: + description: Generates new recovery codes for the logged in user. Generating + new recovery codes you automatically invalidate old ones + operationId: generate_user_recovery_codes + responses: + "200": + content: + application/json: + schema: + items: + type: string + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Generate recovery codes + tags: + - user APIs + /user/totp/configs: + get: + description: Returns the available TOTP configurations for the logged in user + operationId: get_user_totp_configs + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TOTPConfig' + type: array + description: successful operation + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Get available TOTP configuration + tags: + - user APIs + /user/totp/generate: + post: + description: Generates a new TOTP secret, including the QR code as png, using + the specified configuration for the logged in user + operationId: generate_user_totp_secret + requestBody: + $ref: '#/components/requestBodies/inline_object_6' + content: + application/json: + schema: + properties: + config_name: + description: name of the configuration to use to generate the secret + type: string + type: object + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Generate a new TOTP secret + tags: + - user APIs + /user/totp/validate: + post: + description: Checks if the given authentication code can be validated using + the specified secret and config name + operationId: validate_user_totp_secret + requestBody: + $ref: '#/components/requestBodies/inline_object_7' + content: + application/json: + schema: + properties: + config_name: + description: name of the configuration to use to validate the passcode + type: string + passcode: + description: passcode to validate + type: string + secret: + description: secret to use to validate the passcode + type: string + type: object + required: true + responses: + "200": + content: + application/json: + example: + message: Passcode successfully validated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Validate a one time authentication code + tags: + - user APIs + /user/totp/save: + post: + description: Saves the specified TOTP config for the logged in user + operationId: save_user_totp_config + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UserTOTPConfig' + required: true + responses: + "200": + content: + application/json: + example: + message: TOTP configuration saved + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + security: + - BearerAuth: [] + summary: Save a TOTP config + tags: + - user APIs + /user/shares: + get: + description: Returns the share for the logged in user + operationId: get_user_shares + parameters: + - explode: true + in: query + name: offset + required: false + schema: + default: 0 + minimum: 0 + type: integer + style: form + - description: The maximum number of items to return. Max value is 500, default + is 100 + explode: true + in: query + name: limit + required: false + schema: + default: 100 + maximum: 500 + minimum: 1 + type: integer + style: form + - description: Ordering shares by ID. Default ASC + explode: true + in: query + name: order + required: false + schema: + enum: + - ASC + - DESC + example: ASC + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Share' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: List user shares + tags: + - user APIs + post: + description: Adds a new share. The share id will be auto-generated + operationId: add_share + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Share' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + headers: + X-Object-ID: + description: ID for the new created share + explode: false + schema: + type: string + style: simple + Location: + description: URL to retrieve the details for the new created share + explode: false + schema: + type: string + style: simple + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Add a share + tags: + - user APIs + /user/shares/{id}: + delete: + description: Deletes an existing share belonging to the logged in user + operationId: delete_user_share + parameters: + - description: the share id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + message: Share deleted + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Delete share + tags: + - user APIs + get: + description: Returns a share by id for the logged in user + operationId: get_user_share_by_id + parameters: + - description: the share id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Share' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Get share by id + tags: + - user APIs + put: + description: Updates an existing share belonging to the logged in user + operationId: update_user_share + parameters: + - description: the share id + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Share' + required: true + responses: + "200": + content: + application/json: + example: + message: Share updated + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Update share + tags: + - user APIs + /user/folder: + get: + deprecated: true + description: Returns the contents of the specified folder for the logged in + user. Please use '/user/dirs' instead + operationId: get_user_folder_contents + parameters: + - description: Path to the folder to read. It must be URL encoded, for example + the path "my dir/àdir" must be sent as "my%20dir%2F%C3%A0dir". If empty + or missing the root folder is assumed + explode: true + in: query + name: path + required: false + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/DirEntry' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Read folders contents + tags: + - user APIs + /user/dirs: + delete: + description: Delete a directory for the logged in user. Only empty directories + can be deleted + operationId: delete_user_dir + parameters: + - description: Path to the folder to delete. It must be URL encoded, for example + the path "my dir/àdir" must be sent as "my%20dir%2F%C3%A0dir" + explode: true + in: query + name: path + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ApiResponse' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Delete a directory + tags: + - user APIs + get: + description: Returns the contents of the specified directory for the logged + in user + operationId: get_user_dir_contents + parameters: + - description: Path to the folder to read. It must be URL encoded, for example + the path "my dir/àdir" must be sent as "my%20dir%2F%C3%A0dir". If empty + or missing the root folder is assumed + explode: true + in: query + name: path + required: false + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/DirEntry' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Read directory contents + tags: + - user APIs + patch: + description: Rename a directory for the logged in user. The rename is allowed + for empty directory or for non empty local directories, with no virtual folders + inside + operationId: rename_user_dir + parameters: + - description: Path to the folder to rename. It must be URL encoded, for example + the path "my dir/àdir" must be sent as "my%20dir%2F%C3%A0dir" + explode: true + in: query + name: path + required: true + schema: + type: string + style: form + - description: New name. It must be URL encoded, for example the path "my dir/àdir" + must be sent as "my%20dir%2F%C3%A0dir" + explode: true + in: query + name: target + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ApiResponse' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Rename a directory + tags: + - user APIs + post: + description: Create a directory for the logged in user + operationId: create_user_dir + parameters: + - description: Path to the folder to create. It must be URL encoded, for example + the path "my dir/àdir" must be sent as "my%20dir%2F%C3%A0dir" + explode: true + in: query + name: path + required: true + schema: + type: string + style: form + - description: Create parent directories if they do not exist? + explode: true + in: query + name: mkdir_parents + required: false + schema: + type: boolean + style: form + responses: + "201": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ApiResponse' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Create a directory + tags: + - user APIs + /user/file: + get: + deprecated: true + description: Returns the file contents as response body. Please use '/user/files' + instead + operationId: get_user_file + parameters: + - description: Path to the file to download. It must be URL encoded, for example + the path "my dir/àdir/file.txt" must be sent as "my%20dir%2F%C3%A0dir%2Ffile.txt" + explode: true + in: query + name: path + required: true + schema: + type: string + style: form + responses: + "200": + content: + '*/*': + schema: + format: binary + type: string + description: successful operation + "206": + content: + '*/*': + schema: + format: binary + type: string + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Download a single file + tags: + - user APIs + /user/files: + delete: + description: Delete a file for the logged in user. + operationId: delete_user_file + parameters: + - description: Path to the file to delete. It must be URL encoded + explode: true + in: query + name: path + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ApiResponse' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Delete a file + tags: + - user APIs + get: + description: Returns the file contents as response body + operationId: download_user_file + parameters: + - description: Path to the file to download. It must be URL encoded, for example + the path "my dir/àdir/file.txt" must be sent as "my%20dir%2F%C3%A0dir%2Ffile.txt" + explode: true + in: query + name: path + required: true + schema: + type: string + style: form + - description: If set, the response will not have the Content-Disposition header + set to `attachment` + explode: true + in: query + name: inline + required: false + schema: + type: string + style: form + responses: + "200": + content: + '*/*': + schema: + format: binary + type: string + description: successful operation + "206": + content: + '*/*': + schema: + format: binary + type: string + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Download a single file + tags: + - user APIs + patch: + description: Rename a file for the logged in user + operationId: rename_user_file + parameters: + - description: Path to the file to rename. It must be URL encoded + explode: true + in: query + name: path + required: true + schema: + type: string + style: form + - description: New name. It must be URL encoded + explode: true + in: query + name: target + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ApiResponse' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Rename a file + tags: + - user APIs + post: + description: Upload one or more files for the logged in user + operationId: create_user_files + parameters: + - description: Parent directory for the uploaded files. It must be URL encoded, + for example the path "my dir/àdir" must be sent as "my%20dir%2F%C3%A0dir". + If empty or missing the root path is assumed. If a file with the same name + already exists, it will be overwritten + explode: true + in: query + name: path + required: false + schema: + type: string + style: form + - description: Create parent directories if they do not exist? + explode: true + in: query + name: mkdir_parents + required: false + schema: + type: boolean + style: form + requestBody: + $ref: '#/components/requestBodies/inline_object_8' + content: + multipart/form-data: + schema: + properties: + filenames: + items: + format: binary + type: string + minItems: 1 + type: array + uniqueItems: true + type: object + required: true + responses: + "201": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ApiResponse' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "413": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Request Entity Too Large, max allowed size exceeded + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Upload files + tags: + - user APIs + /user/files/upload: + post: + description: Upload a single file for the logged in user to an existing directory. + This API does not use multipart/form-data and so no temporary files are created + server side but only a single file can be uploaded as POST body + operationId: create_user_file + parameters: + - description: Full file path. It must be path encoded, for example the path + "my dir/àdir/file.txt" must be sent as "my%20dir%2F%C3%A0dir%2Ffile.txt". + The parent directory must exist. If a file with the same name already exists, + it will be overwritten + explode: true + in: query + name: path + required: true + schema: + type: string + style: form + - description: Create parent directories if they do not exist? + explode: true + in: query + name: mkdir_parents + required: false + schema: + type: boolean + style: form + - description: File modification time as unix timestamp in milliseconds + explode: false + in: header + name: X-SFTPGO-MTIME + required: false + schema: + type: integer + style: simple + requestBody: + content: + application/*: + schema: + format: binary + type: string + text/*: + schema: + format: binary + type: string + image/*: + schema: + format: binary + type: string + audio/*: + schema: + format: binary + type: string + video/*: + schema: + format: binary + type: string + required: true + responses: + "201": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ApiResponse' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "413": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Request Entity Too Large, max allowed size exceeded + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Upload a single file + tags: + - user APIs + /user/files/metadata: + patch: + description: Set supported metadata attributes for the specified file or directory + operationId: setprops_user_file + parameters: + - description: Full file/directory path. It must be URL encoded, for example + the path "my dir/àdir/file.txt" must be sent as "my%20dir%2F%C3%A0dir%2Ffile.txt" + explode: true + in: query + name: path + required: true + schema: + type: string + style: form + requestBody: + $ref: '#/components/requestBodies/inline_object_9' + content: + application/json: + schema: + properties: + modification_time: + description: File modification time as unix timestamp in milliseconds + type: integer + type: object + required: true + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ApiResponse' + type: array + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "413": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Request Entity Too Large, max allowed size exceeded + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Set metadata for a file/directory + tags: + - user APIs + /user/streamzip: + post: + description: A zip file, containing the specified files and folders, will be + generated on the fly and returned as response body. Only folders and regular + files will be included in the zip + operationId: streamzip + requestBody: + content: + application/json: + schema: + items: + description: Absolute file or folder path + type: string + type: array + required: true + responses: + "200": + content: + application/zip: + schema: + format: binary + type: string + description: successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + summary: Download multiple files and folders as a single zip file + tags: + - user APIs +components: + requestBodies: + inline_object_1: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object_1' + required: true + inline_object_9: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object_9' + required: true + inline_object: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object' + required: true + inline_object_8: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_8' + required: true + inline_object_7: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object_7' + required: true + inline_object_6: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object_6' + required: true + inline_object_5: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object_5' + required: true + inline_object_4: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object_4' + required: true + inline_object_3: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object_3' + required: true + inline_object_2: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object_2' + required: true + responses: + BadRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Bad Request + Unauthorized: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unauthorized + Forbidden: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Forbidden + NotFound: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Not Found + Conflict: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Conflict + RequestEntityTooLarge: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Request Entity Too Large, max allowed size exceeded + InternalServerError: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Internal Server Error + DefaultResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Unexpected Error + schemas: + Permission: + description: | + Permissions: + * `*` - all permissions are granted + * `list` - list items is allowed + * `download` - download files is allowed + * `upload` - upload files is allowed + * `overwrite` - overwrite an existing file, while uploading, is allowed. upload permission is required to allow file overwrite + * `delete` - delete files or directories is allowed + * `delete_files` - delete files is allowed + * `delete_dirs` - delete directories is allowed + * `rename` - rename files or directories is allowed + * `rename_files` - rename files is allowed + * `rename_dirs` - rename directories is allowed + * `create_dirs` - create directories is allowed + * `create_symlinks` - create links is allowed + * `chmod` changing file or directory permissions is allowed + * `chown` changing file or directory owner and group is allowed + * `chtimes` changing file or directory access and modification time is allowed + enum: + - '*' + - list + - download + - upload + - overwrite + - delete + - delete_files + - delete_dirs + - rename + - rename_files + - rename_dirs + - create_dirs + - create_symlinks + - chmod + - chown + - chtimes + type: string + DirPermissions: + additionalProperties: + items: + $ref: '#/components/schemas/Permission' + minItems: 1 + type: array + description: hash map with directory as key and an array of permissions as value. + Directories must be absolute paths, permissions for root directory ("/") are + required + minProperties: 1 + type: object + AdminPermissions: + description: | + Admin permissions: + * `*` - all permissions are granted + * `add_users` - add new users is allowed + * `edit_users` - change existing users is allowed + * `del_users` - remove users is allowed + * `view_users` - list users is allowed + * `view_conns` - list active connections is allowed + * `close_conns` - close active connections is allowed + * `view_status` - view the server status is allowed + * `manage_admins` - manage other admins is allowed + * `manage_apikeys` - manage API keys is allowed + * `quota_scans` - view and start quota scans is allowed + * `manage_system` - backups and restores are allowed + * `manage_defender` - remove ip from the dynamic blocklist is allowed + * `view_defender` - list the dynamic blocklist is allowed + * `retention_checks` - view and start retention checks is allowed + * `metadata_checks` - view and start metadata checks is allowed + * `view_events` - view and search filesystem and provider events is allowed + enum: + - '*' + - add_users + - edit_users + - del_users + - view_users + - view_conns + - close_conns + - view_status + - manage_admins + - manage_apikeys + - quota_scans + - manage_system + - manage_defender + - view_defender + - retention_checks + - metadata_checks + - view_events + type: string + FsProviders: + description: | + Filesystem providers: + * `0` - Local filesystem + * `1` - S3 Compatible Object Storage + * `2` - Google Cloud Storage + * `3` - Azure Blob Storage + * `4` - Local filesystem encrypted + * `5` - SFTP + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + - 5 + type: integer + LoginMethods: + description: | + Available login methods. To enable multi-step authentication you have to allow only multi-step login methods + * `publickey` + * `password` + * `keyboard-interactive` + * `publickey+password` - multi-step auth: public key and password + * `publickey+keyboard-interactive` - multi-step auth: public key and keyboard interactive + * `TLSCertificate` + * `TLSCertificate+password` - multi-step auth: TLS client certificate and password + enum: + - publickey + - password + - keyboard-interactive + - publickey+password + - publickey+keyboard-interactive + - TLSCertificate + - TLSCertificate+password + type: string + SupportedProtocols: + description: | + Protocols: + * `SSH` - includes both SFTP and SSH commands + * `FTP` - plain FTP and FTPES/FTPS + * `DAV` - WebDAV over HTTP/HTTPS + * `HTTP` - WebClient/REST API + enum: + - SSH + - FTP + - DAV + - HTTP + type: string + MFAProtocols: + description: | + Protocols: + * `SSH` - includes both SFTP and SSH commands + * `FTP` - plain FTP and FTPES/FTPS + * `HTTP` - WebClient/REST API + enum: + - SSH + - FTP + - HTTP + type: string + EventProtocols: + description: | + Protocols: + * `SSH` - SSH commands + * `SFTP` - SFTP protocol + * `FTP` - plain FTP and FTPES/FTPS + * `DAV` - WebDAV + * `HTTP` - WebClient/REST API + * `DataRetention` - the event is generated by a data retention check + enum: + - SSH + - SFTP + - SCP + - FTP + - DAV + - HTTP + - DataRetention + type: string + WebClientOptions: + description: | + Options: + * `publickey-change-disabled` - changing SSH public keys is not allowed + * `write-disabled` - upload, rename, delete are not allowed even if the user has permissions for these actions + * `mfa-disabled` - enabling multi-factor authentication is not allowed. This option cannot be set if the user has MFA already enabled + * `password-change-disabled` - changing password is not allowed + * `api-key-auth-change-disabled` - enabling/disabling API key authentication is not allowed + * `info-change-disabled` - changing info such as email and description is not allowed + * `shares-disabled` - sharing files and directories with external users is disabled + * `password-reset-disabled` - resetting the password is disabled + enum: + - publickey-change-disabled + - write-disabled + - mfa-disabled + - password-change-disabled + - api-key-auth-change-disabled + - info-change-disabled + - shares-disabled + - password-reset-disabled + type: string + RetentionCheckNotification: + description: | + Options: + * `Hook` - notify result using the defined hook. A "data_retention_hook" must be defined in your configuration file for this to work + * `Email` - notify results by email. The admin starting the retention check must have an associated email address and the SMTP server must be configured for this to work + enum: + - Hook + - Email + type: string + AuthAPIKeyScope: + description: | + Options: + * `1` - admin scope. The API key will be used to impersonate an SFTPGo admin + * `2` - user scope. The API key will be used to impersonate an SFTPGo user + enum: + - 1 + - 2 + type: integer + ShareScope: + description: | + Options: + * `1` - read scope + * `2` - write scope + enum: + - 1 + - 2 + type: integer + TOTPHMacAlgo: + description: Supported HMAC algorithms for Time-based one time passwords + enum: + - sha1 + - sha256 + - sha512 + type: string + UserType: + description: This is an hint for authentication plugins. It is ignored when + using SFTPGo internal authentication + enum: + - "" + - LDAPUser + - OSUser + type: string + FsEventStatus: + description: | + Event status: + * `1` - no error + * `2` - generic error + * `3` - quota exceeded error + enum: + - 1 + - 2 + - 3 + type: integer + FsEventAction: + enum: + - download + - pre-upload + - upload + - delete + - rename + - mkdir + - rmdir + - ssh_cmd + type: string + ProviderEventAction: + enum: + - add + - update + - delete + type: string + ProviderEventObjectType: + enum: + - user + - admin + - api_key + - share + type: string + TOTPConfig: + example: + name: name + issuer: issuer + properties: + name: + type: string + issuer: + type: string + algo: + $ref: '#/components/schemas/TOTPHMacAlgo' + type: object + RecoveryCode: + description: Recovery codes to use if the user loses access to their second + factor auth device. Each code can only be used once, you should use these + codes to login and disable or reset 2FA for your account + example: + secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + properties: + secret: + $ref: '#/components/schemas/Secret' + used: + type: boolean + type: object + BaseTOTPConfig: + properties: + enabled: + type: boolean + config_name: + description: This name must be defined within the "totp" section of the + SFTPGo configuration file. You will be unable to save a user/admin referencing + a missing config_name + type: string + secret: + $ref: '#/components/schemas/Secret' + type: object + AdminTOTPConfig: + allOf: + - $ref: '#/components/schemas/BaseTOTPConfig' + UserTOTPConfig: + allOf: + - $ref: '#/components/schemas/BaseTOTPConfig' + - $ref: '#/components/schemas/UserTOTPConfig_allOf' + PatternsFilter: + example: + path: path + denied_patterns: + - '*.zip' + allowed_patterns: + - '*.jpg' + - a*b?.png + deny_policy: 9 + properties: + path: + description: exposed virtual path, if no other specific filter is defined, + the filter applies for sub directories too. For example if filters are + defined for the paths "/" and "/sub" then the filters for "/" are applied + for any file outside the "/sub" directory + type: string + allowed_patterns: + description: list of, case insensitive, allowed shell like patterns. + example: + - '*.jpg' + - a*b?.png + items: + type: string + type: array + denied_patterns: + description: list of, case insensitive, denied shell like patterns. Denied + patterns are evaluated before the allowed ones + example: + - '*.zip' + items: + type: string + type: array + deny_policy: + description: | + Deny policies + * `0` - default policy. Denied files/directories matching the filters are visible in directory listing but cannot be uploaded/downloaded/overwritten/renamed + * `1` - deny policy hide. This policy applies the same restrictions as the default one and denied files/directories matching the filters will also be hidden in directory listing. This mode may cause performance issues for large directories + enum: + - 0 + - 1 + type: integer + type: object + HooksFilter: + description: User specific hook overrides + example: + external_auth_disabled: false + pre_login_disabled: false + check_password_disabled: false + properties: + external_auth_disabled: + description: If true, the external auth hook, if defined, will not be executed + example: false + type: boolean + pre_login_disabled: + description: If true, the pre-login hook, if defined, will not be executed + example: false + type: boolean + check_password_disabled: + description: If true, the check password hook, if defined, will not be executed + example: false + type: boolean + type: object + BandwidthLimit: + example: + sources: + - sources + - sources + upload_bandwidth: 8 + download_bandwidth: 9 + properties: + sources: + description: Source networks in CIDR notation as defined in RFC 4632 and + RFC 4291 for example `192.0.2.0/24` or `2001:db8::/32`. The limit applies + if the defined networks contain the client IP + items: + type: string + type: array + upload_bandwidth: + description: Maximum upload bandwidth as KB/s, 0 means unlimited + format: int32 + type: integer + download_bandwidth: + description: Maximum download bandwidth as KB/s, 0 means unlimited + format: int32 + type: integer + type: object + DataTransferLimit: + example: + sources: + - sources + - sources + download_data_transfer: 3 + total_data_transfer: 6 + upload_data_transfer: 6 + properties: + sources: + description: Source networks in CIDR notation as defined in RFC 4632 and + RFC 4291 for example `192.0.2.0/24` or `2001:db8::/32`. The limit applies + if the defined networks contain the client IP + items: + type: string + type: array + upload_data_transfer: + description: Maximum data transfer allowed for uploads as MB. 0 means no + limit + type: integer + download_data_transfer: + description: Maximum data transfer allowed for downloads as MB. 0 means + no limit + type: integer + total_data_transfer: + description: Maximum total data transfer as MB. 0 means unlimited. You can + set a total data transfer instead of the individual values for uploads + and downloads + type: integer + type: object + UserFilters: + description: Additional user options + example: + denied_ip: + - 172.16.0.0/16 + allowed_ip: + - 192.0.2.0/24 + - 2001:db8::/32 + allow_api_key_auth: true + denied_login_methods: + - null + - null + web_client: + - null + - null + data_transfer_limits: + - sources: + - sources + - sources + download_data_transfer: 3 + total_data_transfer: 6 + upload_data_transfer: 6 + - sources: + - sources + - sources + download_data_transfer: 3 + total_data_transfer: 6 + upload_data_transfer: 6 + disable_fs_checks: false + file_patterns: + - path: path + denied_patterns: + - '*.zip' + allowed_patterns: + - '*.jpg' + - a*b?.png + deny_policy: 9 + - path: path + denied_patterns: + - '*.zip' + allowed_patterns: + - '*.jpg' + - a*b?.png + deny_policy: 9 + recovery_codes: + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + max_upload_file_size: 6 + tls_username: None + denied_protocols: + - null + - null + hooks: + external_auth_disabled: false + pre_login_disabled: false + check_password_disabled: false + bandwidth_limits: + - sources: + - sources + - sources + upload_bandwidth: 8 + download_bandwidth: 9 + - sources: + - sources + - sources + upload_bandwidth: 8 + download_bandwidth: 9 + properties: + allowed_ip: + description: only clients connecting from these IP/Mask are allowed. IP/Mask + must be in CIDR notation as defined in RFC 4632 and RFC 4291, for example + "192.0.2.0/24" or "2001:db8::/32" + example: + - 192.0.2.0/24 + - 2001:db8::/32 + items: + type: string + type: array + denied_ip: + description: clients connecting from these IP/Mask are not allowed. Denied + rules are evaluated before allowed ones + example: + - 172.16.0.0/16 + items: + type: string + type: array + denied_login_methods: + description: if null or empty any available login method is allowed + items: + $ref: '#/components/schemas/LoginMethods' + type: array + denied_protocols: + description: if null or empty any available protocol is allowed + items: + $ref: '#/components/schemas/SupportedProtocols' + type: array + file_patterns: + description: filters based on shell like file patterns. These restrictions + do not apply to files listing for performance reasons, so a denied file + cannot be downloaded/overwritten/renamed but it will still be in the list + of files. Please note that these restrictions can be easily bypassed + items: + $ref: '#/components/schemas/PatternsFilter' + type: array + max_upload_file_size: + description: maximum allowed size, as bytes, for a single file upload. The + upload will be aborted if/when the size of the file being sent exceeds + this limit. 0 means unlimited. This restriction does not apply for SSH + system commands such as `git` and `rsync` + format: int64 + type: integer + tls_username: + description: defines the TLS certificate field to use as username. For FTP + clients it must match the name provided using the "USER" command. For + WebDAV, if no username is provided, the CN will be used as username. For + WebDAV clients it must match the implicit or provided username. Ignored + if mutual TLS is disabled + enum: + - None + - CommonName + type: string + hooks: + $ref: '#/components/schemas/HooksFilter' + disable_fs_checks: + description: Disable checks for existence and automatic creation of home + directory and virtual folders. SFTPGo requires that the user's home directory, + virtual folder root, and intermediate paths to virtual folders exist to + work properly. If you already know that the required directories exist, + disabling these checks will speed up login. You could, for example, disable + these checks after the first login + example: false + type: boolean + web_client: + description: WebClient/user REST API related configuration options + items: + $ref: '#/components/schemas/WebClientOptions' + type: array + allow_api_key_auth: + description: API key authentication allows to impersonate this user with + an API key + type: boolean + user_type: + $ref: '#/components/schemas/UserType' + totp_config: + $ref: '#/components/schemas/UserTOTPConfig' + recovery_codes: + items: + $ref: '#/components/schemas/RecoveryCode' + type: array + bandwidth_limits: + items: + $ref: '#/components/schemas/BandwidthLimit' + type: array + data_transfer_limits: + items: + $ref: '#/components/schemas/DataTransferLimit' + type: array + type: object + Secret: + description: The secret is encrypted before saving, so to set a new secret you + must provide a payload and set the status to "Plain". The encryption key and + additional data will be generated automatically. If you set the status to + "Redacted" the existig secret will be preserved + example: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + properties: + status: + description: Set to "Plain" to add or update an existing secret, set to + "Redacted" to preserve the existing value + enum: + - Plain + - AES-256-GCM + - Secretbox + - GCP + - AWS + - VaultTransit + - AzureKeyVault + - Redacted + type: string + payload: + type: string + key: + type: string + additional_data: + type: string + mode: + description: 1 means encrypted using a master key + type: integer + type: object + S3Config: + description: S3 Compatible Object Storage configuration details + example: + upload_part_max_time: 6 + storage_class: storage_class + force_path_style: true + download_part_max_time: 6 + acl: acl + download_concurrency: 5 + bucket: bucket + endpoint: endpoint + upload_part_size: 1 + key_prefix: folder/subfolder/ + access_key: access_key + access_secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + download_part_size: 6 + region: region + upload_concurrency: 2 + properties: + bucket: + minLength: 1 + type: string + region: + minLength: 1 + type: string + access_key: + type: string + access_secret: + $ref: '#/components/schemas/Secret' + endpoint: + description: optional endpoint + type: string + storage_class: + type: string + acl: + description: 'The canned ACL to apply to uploaded objects. Leave empty to + use the default ACL. For more information and available ACLs, see here: + https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl' + type: string + upload_part_size: + description: the buffer size (in MB) to use for multipart uploads. The minimum + allowed part size is 5MB, and if this value is set to zero, the default + value (5MB) for the AWS SDK will be used. The minimum allowed value is + 5. + type: integer + upload_concurrency: + description: the number of parts to upload in parallel. If this value is + set to zero, the default value (5) will be used + type: integer + upload_part_max_time: + description: the maximum time allowed, in seconds, to upload a single chunk + (the chunk size is defined via "upload_part_size"). 0 means no timeout + type: integer + download_part_size: + description: the buffer size (in MB) to use for multipart downloads. The + minimum allowed part size is 5MB, and if this value is set to zero, the + default value (5MB) for the AWS SDK will be used. The minimum allowed + value is 5. Ignored for partial downloads + type: integer + download_concurrency: + description: the number of parts to download in parallel. If this value + is set to zero, the default value (5) will be used. Ignored for partial + downloads + type: integer + download_part_max_time: + description: the maximum time allowed, in seconds, to download a single + chunk (the chunk size is defined via "download_part_size"). 0 means no + timeout. Ignored for partial downloads. + type: integer + force_path_style: + description: Set this to "true" to force the request to use path-style addressing, + i.e., "http://s3.amazonaws.com/BUCKET/KEY". By default, the S3 client + will use virtual hosted bucket addressing when possible ("http://BUCKET.s3.amazonaws.com/KEY") + type: boolean + key_prefix: + description: key_prefix is similar to a chroot directory for a local filesystem. + If specified the user will only see contents that starts with this prefix + and so you can restrict access to a specific virtual folder. The prefix, + if not empty, must not start with "/" and must end with "/". If empty + the whole bucket contents will be available + example: folder/subfolder/ + type: string + type: object + GCSConfig: + description: Google Cloud Storage configuration details. The "credentials" field + must be populated only when adding/updating a user. It will be always omitted, + since there are sensitive data, when you search/get users + example: + bucket: bucket + storage_class: storage_class + credentials: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + automatic_credentials: 3 + key_prefix: folder/subfolder/ + acl: acl + properties: + bucket: + minLength: 1 + type: string + credentials: + $ref: '#/components/schemas/Secret' + automatic_credentials: + description: | + Automatic credentials: + * `0` - disabled, explicit credentials, using a JSON credentials file, must be provided. This is the default value if the field is null + * `1` - enabled, we try to use the Application Default Credentials (ADC) strategy to find your application's credentials + enum: + - 0 + - 1 + type: integer + storage_class: + type: string + acl: + description: 'The ACL to apply to uploaded objects. Leave empty to use the + default ACL. For more information and available ACLs, refer to the JSON + API here: https://cloud.google.com/storage/docs/access-control/lists#predefined-acl' + type: string + key_prefix: + description: key_prefix is similar to a chroot directory for a local filesystem. + If specified the user will only see contents that starts with this prefix + and so you can restrict access to a specific virtual folder. The prefix, + if not empty, must not start with "/" and must end with "/". If empty + the whole bucket contents will be available + example: folder/subfolder/ + type: string + type: object + AzureBlobFsConfig: + description: Azure Blob Storage configuration details + example: + container: container + sas_url: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + endpoint: endpoint + upload_part_size: 3 + key_prefix: folder/subfolder/ + account_name: account_name + account_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + access_tier: "" + use_emulator: true + upload_concurrency: 7 + properties: + container: + type: string + account_name: + description: Storage Account Name, leave blank to use SAS URL + type: string + account_key: + $ref: '#/components/schemas/Secret' + sas_url: + $ref: '#/components/schemas/Secret' + endpoint: + description: optional endpoint. Default is "blob.core.windows.net". If you + use the emulator the endpoint must include the protocol, for example "http://127.0.0.1:10000" + type: string + upload_part_size: + description: the buffer size (in MB) to use for multipart uploads. If this + value is set to zero, the default value (4MB) will be used. + type: integer + upload_concurrency: + description: the number of parts to upload in parallel. If this value is + set to zero, the default value (2) will be used + type: integer + access_tier: + enum: + - "" + - Archive + - Hot + - Cool + type: string + key_prefix: + description: key_prefix is similar to a chroot directory for a local filesystem. + If specified the user will only see contents that starts with this prefix + and so you can restrict access to a specific virtual folder. The prefix, + if not empty, must not start with "/" and must end with "/". If empty + the whole container contents will be available + example: folder/subfolder/ + type: string + use_emulator: + type: boolean + type: object + CryptFsConfig: + description: Crypt filesystem configuration details + example: + passphrase: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + properties: + passphrase: + $ref: '#/components/schemas/Secret' + type: object + SFTPFsConfig: + example: + endpoint: endpoint + password: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + disable_concurrent_reads: true + prefix: prefix + buffer_size: 2 + private_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + username: username + fingerprints: + - fingerprints + - fingerprints + properties: + endpoint: + description: remote SFTP endpoint as host:port + type: string + username: + description: you can specify a password or private key or both. In the latter + case the private key will be tried first. + type: string + password: + $ref: '#/components/schemas/Secret' + private_key: + $ref: '#/components/schemas/Secret' + fingerprints: + description: SHA256 fingerprints to use for host key verification. If you + don't provide any fingerprint the remote host key will not be verified, + this is a security risk + items: + type: string + type: array + prefix: + description: Specifying a prefix you can restrict all operations to a given + path within the remote SFTP server. + type: string + disable_concurrent_reads: + description: Concurrent reads are safe to use and disabling them will degrade + performance. Some servers automatically delete files once they are downloaded. + Using concurrent reads is problematic with such servers. + type: boolean + buffer_size: + description: The size of the buffer (in MB) to use for transfers. By enabling + buffering, the reads and writes, from/to the remote SFTP server, are split + in multiple concurrent requests and this allows data to be transferred + at a faster rate, over high latency networks, by overlapping round-trip + times. With buffering enabled, resuming uploads is not supported and a + file cannot be opened for both reading and writing at the same time. 0 + means disabled. + example: 2 + maximum: 16 + minimum: 0 + type: integer + type: object + FilesystemConfig: + description: Storage filesystem details + example: + gcsconfig: + bucket: bucket + storage_class: storage_class + credentials: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + automatic_credentials: 3 + key_prefix: folder/subfolder/ + acl: acl + sftpconfig: + endpoint: endpoint + password: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + disable_concurrent_reads: true + prefix: prefix + buffer_size: 2 + private_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + username: username + fingerprints: + - fingerprints + - fingerprints + cryptconfig: + passphrase: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + azblobconfig: + container: container + sas_url: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + endpoint: endpoint + upload_part_size: 3 + key_prefix: folder/subfolder/ + account_name: account_name + account_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + access_tier: "" + use_emulator: true + upload_concurrency: 7 + s3config: + upload_part_max_time: 6 + storage_class: storage_class + force_path_style: true + download_part_max_time: 6 + acl: acl + download_concurrency: 5 + bucket: bucket + endpoint: endpoint + upload_part_size: 1 + key_prefix: folder/subfolder/ + access_key: access_key + access_secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + download_part_size: 6 + region: region + upload_concurrency: 2 + properties: + provider: + $ref: '#/components/schemas/FsProviders' + s3config: + $ref: '#/components/schemas/S3Config' + gcsconfig: + $ref: '#/components/schemas/GCSConfig' + azblobconfig: + $ref: '#/components/schemas/AzureBlobFsConfig' + cryptconfig: + $ref: '#/components/schemas/CryptFsConfig' + sftpconfig: + $ref: '#/components/schemas/SFTPFsConfig' + type: object + BaseVirtualFolder: + description: Defines the filesystem for the virtual folder and the used quota + limits. The same folder can be shared among multiple users and each user can + have different quota limits or a different virtual path. + example: + mapped_path: mapped_path + used_quota_size: 6 + last_quota_update: 5 + name: name + used_quota_files: 1 + description: description + id: 1 + users: + - users + - users + filesystem: + gcsconfig: + bucket: bucket + storage_class: storage_class + credentials: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + automatic_credentials: 3 + key_prefix: folder/subfolder/ + acl: acl + sftpconfig: + endpoint: endpoint + password: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + disable_concurrent_reads: true + prefix: prefix + buffer_size: 2 + private_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + username: username + fingerprints: + - fingerprints + - fingerprints + cryptconfig: + passphrase: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + azblobconfig: + container: container + sas_url: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + endpoint: endpoint + upload_part_size: 3 + key_prefix: folder/subfolder/ + account_name: account_name + account_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + access_tier: "" + use_emulator: true + upload_concurrency: 7 + s3config: + upload_part_max_time: 6 + storage_class: storage_class + force_path_style: true + download_part_max_time: 6 + acl: acl + download_concurrency: 5 + bucket: bucket + endpoint: endpoint + upload_part_size: 1 + key_prefix: folder/subfolder/ + access_key: access_key + access_secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + download_part_size: 6 + region: region + upload_concurrency: 2 + properties: + id: + format: int32 + minimum: 1 + type: integer + name: + description: unique name for this virtual folder + type: string + mapped_path: + description: absolute filesystem path to use as virtual folder + type: string + description: + description: optional description + type: string + used_quota_size: + format: int64 + type: integer + used_quota_files: + format: int32 + type: integer + last_quota_update: + description: Last quota update as unix timestamp in milliseconds + format: int64 + type: integer + users: + description: list of usernames associated with this virtual folder + items: + type: string + type: array + filesystem: + $ref: '#/components/schemas/FilesystemConfig' + type: object + VirtualFolder: + allOf: + - $ref: '#/components/schemas/BaseVirtualFolder' + - $ref: '#/components/schemas/VirtualFolder_allOf' + description: A virtual folder is a mapping between a SFTPGo virtual path and + a filesystem path outside the user home directory. The specified paths must + be absolute and the virtual path cannot be "/", it must be a sub directory. + The parent directory for the specified virtual path must exist. SFTPGo will + try to automatically create any missing parent directory for the configured + virtual folders at user login. + User: + example: + used_download_data_transfer: 1 + gid: 1210617418 + max_sessions: 2 + download_data_transfer: 1 + description: description + created_at: 4 + expiration_date: 1 + upload_data_transfer: 1 + public_keys: + - ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEUWwDwEWhTbF0MqAsp/oXK1HR2cElhM8oo1uVmL3ZeDKDiTm4ljMr92wfTgIGDqIoxmVqgYIkAOAhuykAVWBzc= + user@host + - ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEUWwDwEWhTbF0MqAsp/oXK1HR2cElhM8oo1uVmL3ZeDKDiTm4ljMr92wfTgIGDqIoxmVqgYIkAOAhuykAVWBzc= + user@host + virtual_folders: + - null + - null + uid: 1280358508 + used_quota_size: 3 + password: password + last_quota_update: 4 + updated_at: 5 + permissions: + /: + - '*' + /somedir: + - list + - download + used_quota_files: 2 + id: 1 + email: email + used_upload_data_transfer: 7 + last_login: 9 + home_dir: home_dir + total_data_transfer: 6 + filters: + denied_ip: + - 172.16.0.0/16 + allowed_ip: + - 192.0.2.0/24 + - 2001:db8::/32 + allow_api_key_auth: true + denied_login_methods: + - null + - null + web_client: + - null + - null + data_transfer_limits: + - sources: + - sources + - sources + download_data_transfer: 3 + total_data_transfer: 6 + upload_data_transfer: 6 + - sources: + - sources + - sources + download_data_transfer: 3 + total_data_transfer: 6 + upload_data_transfer: 6 + disable_fs_checks: false + file_patterns: + - path: path + denied_patterns: + - '*.zip' + allowed_patterns: + - '*.jpg' + - a*b?.png + deny_policy: 9 + - path: path + denied_patterns: + - '*.zip' + allowed_patterns: + - '*.jpg' + - a*b?.png + deny_policy: 9 + recovery_codes: + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + max_upload_file_size: 6 + tls_username: None + denied_protocols: + - null + - null + hooks: + external_auth_disabled: false + pre_login_disabled: false + check_password_disabled: false + bandwidth_limits: + - sources: + - sources + - sources + upload_bandwidth: 8 + download_bandwidth: 9 + - sources: + - sources + - sources + upload_bandwidth: 8 + download_bandwidth: 9 + filesystem: + gcsconfig: + bucket: bucket + storage_class: storage_class + credentials: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + automatic_credentials: 3 + key_prefix: folder/subfolder/ + acl: acl + sftpconfig: + endpoint: endpoint + password: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + disable_concurrent_reads: true + prefix: prefix + buffer_size: 2 + private_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + username: username + fingerprints: + - fingerprints + - fingerprints + cryptconfig: + passphrase: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + azblobconfig: + container: container + sas_url: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + endpoint: endpoint + upload_part_size: 3 + key_prefix: folder/subfolder/ + account_name: account_name + account_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + access_tier: "" + use_emulator: true + upload_concurrency: 7 + s3config: + upload_part_max_time: 6 + storage_class: storage_class + force_path_style: true + download_part_max_time: 6 + acl: acl + download_concurrency: 5 + bucket: bucket + endpoint: endpoint + upload_part_size: 1 + key_prefix: folder/subfolder/ + access_key: access_key + access_secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + download_part_size: 6 + region: region + upload_concurrency: 2 + quota_files: 9 + download_bandwidth: 1 + quota_size: 7 + additional_info: additional_info + upload_bandwidth: 7 + status: 6 + username: username + properties: + id: + format: int32 + minimum: 1 + type: integer + status: + description: | + status: + * `0` user is disabled, login is not allowed + * `1` user is enabled + enum: + - 0 + - 1 + type: integer + username: + description: username is unique + type: string + email: + format: email + type: string + description: + description: optional description, for example the user full name + type: string + expiration_date: + description: expiration date as unix timestamp in milliseconds. An expired + account cannot login. 0 means no expiration + format: int64 + type: integer + password: + description: password or public key/SSH user certificate are mandatory. + If the password has no known hashing algo prefix it will be stored, by + default, using bcrypt, argon2id is supported too. You can send a password + hashed as bcrypt ($2a$ prefix), argon2id, pbkdf2 or unix crypt and it + will be stored as is. For security reasons this field is omitted when + you search/get users + format: password + type: string + public_keys: + description: Public keys in OpenSSH format. A password or at least one public + key/SSH user certificate are mandatory. + items: + example: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEUWwDwEWhTbF0MqAsp/oXK1HR2cElhM8oo1uVmL3ZeDKDiTm4ljMr92wfTgIGDqIoxmVqgYIkAOAhuykAVWBzc= + user@host + type: string + type: array + home_dir: + description: path to the user home directory. The user cannot upload or + download files outside this directory. SFTPGo tries to automatically create + this folder if missing. Must be an absolute path + type: string + virtual_folders: + description: mapping between virtual SFTPGo paths and filesystem paths outside + the user home directory. Supported for local filesystem only. If one or + more of the specified folders are not inside the dataprovider they will + be automatically created. You have to create the folder on the filesystem + yourself + items: + $ref: '#/components/schemas/VirtualFolder' + type: array + uid: + description: if you run SFTPGo as root user, the created files and directories + will be assigned to this uid. 0 means no change, the owner will be the + user that runs SFTPGo. Ignored on windows + format: int32 + maximum: 2147483647 + minimum: 0 + type: integer + gid: + description: if you run SFTPGo as root user, the created files and directories + will be assigned to this gid. 0 means no change, the group will be the + one of the user that runs SFTPGo. Ignored on windows + format: int32 + maximum: 2147483647 + minimum: 0 + type: integer + max_sessions: + description: Limit the sessions that a user can open. 0 means unlimited + format: int32 + type: integer + quota_size: + description: Quota as size in bytes. 0 menas unlimited. Please note that + quota is updated if files are added/removed via SFTPGo otherwise a quota + scan or a manual quota update is needed + format: int64 + type: integer + quota_files: + description: Quota as number of files. 0 menas unlimited. Please note that + quota is updated if files are added/removed via SFTPGo otherwise a quota + scan or a manual quota update is needed + format: int32 + type: integer + permissions: + example: + /: + - '*' + /somedir: + - list + - download + items: + $ref: '#/components/schemas/DirPermissions' + minItems: 1 + type: array + used_quota_size: + format: int64 + type: integer + used_quota_files: + format: int32 + type: integer + last_quota_update: + description: Last quota update as unix timestamp in milliseconds + format: int64 + type: integer + upload_bandwidth: + description: Maximum upload bandwidth as KB/s, 0 means unlimited + type: integer + download_bandwidth: + description: Maximum download bandwidth as KB/s, 0 means unlimited + type: integer + upload_data_transfer: + description: Maximum data transfer allowed for uploads as MB. 0 means no + limit + type: integer + download_data_transfer: + description: Maximum data transfer allowed for downloads as MB. 0 means + no limit + type: integer + total_data_transfer: + description: Maximum total data transfer as MB. 0 means unlimited. You can + set a total data transfer instead of the individual values for uploads + and downloads + type: integer + used_upload_data_transfer: + description: Uploaded size, as bytes, since the last reset + type: integer + used_download_data_transfer: + description: Downloaded size, as bytes, since the last reset + type: integer + created_at: + description: creation time as unix timestamp in milliseconds. It will be + 0 for users created before v2.2.0 + format: int64 + type: integer + updated_at: + description: last update time as unix timestamp in milliseconds + format: int64 + type: integer + last_login: + description: Last user login as unix timestamp in milliseconds. It is saved + at most once every 10 minutes + format: int64 + type: integer + filters: + $ref: '#/components/schemas/UserFilters' + filesystem: + $ref: '#/components/schemas/FilesystemConfig' + additional_info: + description: Free form text field for external systems + type: string + type: object + AdminFilters: + example: + allow_list: + - 192.0.2.0/24 + - 2001:db8::/32 + recovery_codes: + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + allow_api_key_auth: true + properties: + allow_list: + description: only clients connecting from these IP/Mask are allowed. IP/Mask + must be in CIDR notation as defined in RFC 4632 and RFC 4291, for example + "192.0.2.0/24" or "2001:db8::/32" + example: + - 192.0.2.0/24 + - 2001:db8::/32 + items: + type: string + type: array + allow_api_key_auth: + description: API key auth allows to impersonate this administrator with + an API key + type: boolean + totp_config: + $ref: '#/components/schemas/AdminTOTPConfig' + recovery_codes: + items: + $ref: '#/components/schemas/RecoveryCode' + type: array + type: object + Admin: + example: + password: password + updated_at: 5 + additional_info: additional_info + permissions: + - null + - null + last_login: 5 + description: description + created_at: 1 + id: 1 + filters: + allow_list: + - 192.0.2.0/24 + - 2001:db8::/32 + recovery_codes: + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + allow_api_key_auth: true + email: email + status: 6 + username: username + properties: + id: + format: int32 + minimum: 1 + type: integer + status: + description: | + status: + * `0` user is disabled, login is not allowed + * `1` user is enabled + enum: + - 0 + - 1 + type: integer + username: + description: username is unique + type: string + description: + description: optional description, for example the admin full name + type: string + password: + description: Admin password. For security reasons this field is omitted + when you search/get admins + format: password + type: string + email: + format: email + type: string + permissions: + items: + $ref: '#/components/schemas/AdminPermissions' + type: array + filters: + $ref: '#/components/schemas/AdminFilters' + additional_info: + description: Free form text field + type: string + created_at: + description: creation time as unix timestamp in milliseconds. It will be + 0 for admins created before v2.2.0 + format: int64 + type: integer + updated_at: + description: last update time as unix timestamp in milliseconds + format: int64 + type: integer + last_login: + description: Last user login as unix timestamp in milliseconds. It is saved + at most once every 10 minutes + format: int64 + type: integer + type: object + AdminProfile: + example: + description: description + email: email + allow_api_key_auth: true + properties: + email: + format: email + type: string + description: + type: string + allow_api_key_auth: + description: If enabled, you can impersonate this admin, in REST API, using + an API key. If disabled admin credentials are required for impersonation + type: boolean + type: object + UserProfile: + example: + public_keys: + - ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEUWwDwEWhTbF0MqAsp/oXK1HR2cElhM8oo1uVmL3ZeDKDiTm4ljMr92wfTgIGDqIoxmVqgYIkAOAhuykAVWBzc= + user@host + - ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEUWwDwEWhTbF0MqAsp/oXK1HR2cElhM8oo1uVmL3ZeDKDiTm4ljMr92wfTgIGDqIoxmVqgYIkAOAhuykAVWBzc= + user@host + description: description + email: email + allow_api_key_auth: true + properties: + email: + format: email + type: string + description: + type: string + allow_api_key_auth: + description: If enabled, you can impersonate this user, in REST API, using + an API key. If disabled user credentials are required for impersonation + type: boolean + public_keys: + items: + description: Public keys in OpenSSH format + example: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEUWwDwEWhTbF0MqAsp/oXK1HR2cElhM8oo1uVmL3ZeDKDiTm4ljMr92wfTgIGDqIoxmVqgYIkAOAhuykAVWBzc= + user@host + type: string + type: array + type: object + AuthAPIKey: + example: + expires_at: 5 + updated_at: 6 + last_use_at: 1 + name: name + created_at: 0 + description: description + admin: admin + id: id + user: user + key: key + properties: + id: + description: unique key identifier + type: string + name: + description: User friendly key name + type: string + key: + description: We store the hash of the key. This is just like a password. + For security reasons this field is omitted when you search/get API keys + format: password + type: string + scope: + $ref: '#/components/schemas/AuthAPIKeyScope' + created_at: + description: creation time as unix timestamp in milliseconds + format: int64 + type: integer + updated_at: + description: last update time as unix timestamp in milliseconds + format: int64 + type: integer + last_use_at: + description: last use time as unix timestamp in milliseconds. It is saved + at most once every 10 minutes + format: int64 + type: integer + expires_at: + description: expiration time as unix timestamp in milliseconds + format: int64 + type: integer + description: + description: optional description + type: string + user: + description: username associated with this API key. If empty and the scope + is "user scope" the key can impersonate any user + type: string + admin: + description: admin associated with this API key. If empty and the scope + is "admin scope" the key can impersonate any admin + type: string + type: object + QuotaUsage: + example: + used_quota_size: 0 + used_quota_files: 6 + properties: + used_quota_size: + format: int64 + type: integer + used_quota_files: + format: int32 + type: integer + type: object + TransferQuotaUsage: + example: + used_download_data_transfer: 6 + used_upload_data_transfer: 0 + properties: + used_upload_data_transfer: + description: The value must be specified as bytes + format: int64 + type: integer + used_download_data_transfer: + description: The value must be specified as bytes + format: int64 + type: integer + type: object + Transfer: + example: + path: path + start_time: 1 + operation_type: upload + size: 5 + properties: + operation_type: + description: | + Operations: + * `upload` + * `download` + enum: + - upload + - download + type: string + path: + description: file path for the upload/download + type: string + start_time: + description: start time as unix timestamp in milliseconds + format: int64 + type: integer + size: + description: bytes transferred + format: int64 + type: integer + type: object + ConnectionStatus: + example: + connection_time: 0 + protocol: SFTP + last_activity: 6 + connection_id: connection_id + active_transfers: + - path: path + start_time: 1 + operation_type: upload + size: 5 + - path: path + start_time: 1 + operation_type: upload + size: 5 + remote_address: remote_address + client_version: client_version + command: command + username: username + properties: + username: + description: connected username + type: string + connection_id: + description: unique connection identifier + type: string + client_version: + description: client version + type: string + remote_address: + description: Remote address for the connected client + type: string + connection_time: + description: connection time as unix timestamp in milliseconds + format: int64 + type: integer + command: + description: Last SSH/FTP command or WebDAV method + type: string + last_activity: + description: last client activity as unix timestamp in milliseconds + format: int64 + type: integer + protocol: + enum: + - SFTP + - SCP + - SSH + - FTP + - DAV + type: string + active_transfers: + items: + $ref: '#/components/schemas/Transfer' + type: array + type: object + FolderRetention: + example: + path: / + ignore_user_permissions: true + retention: 24 + delete_empty_dirs: true + properties: + path: + description: exposed virtual directory path, if no other specific retention + is defined, the retention applies for sub directories too. For example + if retention is defined for the paths "/" and "/sub" then the retention + for "/" is applied for any file outside the "/sub" directory + example: / + type: string + retention: + description: retention time in hours. All the files with a modification + time older than the defined value will be deleted. 0 means exclude this + path + example: 24 + type: integer + delete_empty_dirs: + description: if enabled, empty directories will be deleted + type: boolean + ignore_user_permissions: + description: if enabled, files will be deleted even if the user does not + have the delete permission. The default is "false" which means that files + will be skipped if the user does not have permission to delete them. File + patterns filters will always be silently ignored + type: boolean + type: object + RetentionCheck: + example: + start_time: 0 + folders: + - path: / + ignore_user_permissions: true + retention: 24 + delete_empty_dirs: true + - path: / + ignore_user_permissions: true + retention: 24 + delete_empty_dirs: true + notifications: + - null + - null + email: email + username: username + properties: + username: + description: username to which the retention check refers + type: string + folders: + items: + $ref: '#/components/schemas/FolderRetention' + type: array + start_time: + description: check start time as unix timestamp in milliseconds + format: int64 + type: integer + notifications: + items: + $ref: '#/components/schemas/RetentionCheckNotification' + type: array + email: + description: if the notification method is set to "Email", this is the e-mail + address that receives the retention check report. This field is automatically + set to the email address associated with the administrator starting the + check + format: email + type: string + type: object + MetadataCheck: + example: + start_time: 0 + username: username + properties: + username: + description: username to which the check refers + type: string + start_time: + description: check start time as unix timestamp in milliseconds + format: int64 + type: integer + type: object + QuotaScan: + example: + start_time: 0 + username: username + properties: + username: + description: username to which the quota scan refers + type: string + start_time: + description: scan start time as unix timestamp in milliseconds + format: int64 + type: integer + type: object + FolderQuotaScan: + example: + start_time: 0 + name: name + properties: + name: + description: folder name to which the quota scan refers + type: string + start_time: + description: scan start time as unix timestamp in milliseconds + format: int64 + type: integer + type: object + DefenderEntry: + example: + score: 0 + ip: ip + ban_time: 2000-01-23T04:56:07.000+00:00 + id: id + properties: + id: + type: string + ip: + type: string + score: + description: the score increases whenever a violation is detected, such + as an attempt to log in using an incorrect password or invalid username. + If the score exceeds the configured threshold, the IP is banned. Omitted + for banned IPs + type: integer + ban_time: + description: date time until the IP is banned. For already banned hosts, + the ban time is increased each time a new violation is detected. Omitted + if the IP is not banned + format: date-time + type: string + type: object + SSHHostKey: + example: + path: path + fingerprint: fingerprint + properties: + path: + type: string + fingerprint: + type: string + type: object + SSHBinding: + example: + address: address + apply_proxy_config: true + port: 0 + properties: + address: + description: TCP address the server listen on + type: string + port: + description: the port used for serving requests + type: integer + apply_proxy_config: + description: apply the proxy configuration, if any + type: boolean + type: object + WebDAVBinding: + example: + client_auth_type: 9 + address: address + port: 7 + enable_https: true + properties: + address: + description: TCP address the server listen on + type: string + port: + description: the port used for serving requests + type: integer + enable_https: + type: boolean + client_auth_type: + description: 1 means that client certificate authentication is required + in addition to HTTP basic authentication + type: integer + type: object + FTPDBinding: + example: + force_passive_ip: force_passive_ip + client_auth_type: 5 + address: address + apply_proxy_config: true + tls_mode: 1 + port: 6 + properties: + address: + description: TCP address the server listen on + type: string + port: + description: the port used for serving requests + type: integer + apply_proxy_config: + description: apply the proxy configuration, if any + type: boolean + tls_mode: + description: | + TLS mode: + * `0` - clear or explicit TLS + * `1` - explicit TLS required + * `2` - implicit TLS + enum: + - 0 + - 1 + - 2 + type: integer + force_passive_ip: + description: External IP address to expose for passive connections + type: string + client_auth_type: + description: 1 means that client certificate authentication is required + in addition to FTP authentication + type: integer + type: object + SSHServiceStatus: + example: + host_keys: + - path: path + fingerprint: fingerprint + - path: path + fingerprint: fingerprint + is_active: true + ssh_commands: + - ssh_commands + - ssh_commands + bindings: + - address: address + apply_proxy_config: true + port: 0 + - address: address + apply_proxy_config: true + port: 0 + properties: + is_active: + type: boolean + bindings: + items: + $ref: '#/components/schemas/SSHBinding' + nullable: true + type: array + host_keys: + items: + $ref: '#/components/schemas/SSHHostKey' + nullable: true + type: array + ssh_commands: + items: + type: string + type: array + type: object + FTPPassivePortRange: + example: + start: 5 + end: 2 + properties: + start: + type: integer + end: + type: integer + type: object + FTPServiceStatus: + example: + is_active: true + bindings: + - force_passive_ip: force_passive_ip + client_auth_type: 5 + address: address + apply_proxy_config: true + tls_mode: 1 + port: 6 + - force_passive_ip: force_passive_ip + client_auth_type: 5 + address: address + apply_proxy_config: true + tls_mode: 1 + port: 6 + passive_port_range: + start: 5 + end: 2 + properties: + is_active: + type: boolean + bindings: + items: + $ref: '#/components/schemas/FTPDBinding' + nullable: true + type: array + passive_port_range: + $ref: '#/components/schemas/FTPPassivePortRange' + type: object + WebDAVServiceStatus: + example: + is_active: true + bindings: + - client_auth_type: 9 + address: address + port: 7 + enable_https: true + - client_auth_type: 9 + address: address + port: 7 + enable_https: true + properties: + is_active: + type: boolean + bindings: + items: + $ref: '#/components/schemas/WebDAVBinding' + nullable: true + type: array + type: object + DataProviderStatus: + example: + is_active: true + driver: driver + error: error + properties: + is_active: + type: boolean + driver: + type: string + error: + type: string + type: object + MFAStatus: + example: + is_active: true + totp_configs: + - name: name + issuer: issuer + - name: name + issuer: issuer + properties: + is_active: + type: boolean + totp_configs: + items: + $ref: '#/components/schemas/TOTPConfig' + type: array + type: object + ServicesStatus: + example: + ftp: + is_active: true + bindings: + - force_passive_ip: force_passive_ip + client_auth_type: 5 + address: address + apply_proxy_config: true + tls_mode: 1 + port: 6 + - force_passive_ip: force_passive_ip + client_auth_type: 5 + address: address + apply_proxy_config: true + tls_mode: 1 + port: 6 + passive_port_range: + start: 5 + end: 2 + ssh: + host_keys: + - path: path + fingerprint: fingerprint + - path: path + fingerprint: fingerprint + is_active: true + ssh_commands: + - ssh_commands + - ssh_commands + bindings: + - address: address + apply_proxy_config: true + port: 0 + - address: address + apply_proxy_config: true + port: 0 + mfa: + is_active: true + totp_configs: + - name: name + issuer: issuer + - name: name + issuer: issuer + data_provider: + is_active: true + driver: driver + error: error + webdav: + is_active: true + bindings: + - client_auth_type: 9 + address: address + port: 7 + enable_https: true + - client_auth_type: 9 + address: address + port: 7 + enable_https: true + defender: + is_active: true + properties: + ssh: + $ref: '#/components/schemas/SSHServiceStatus' + ftp: + $ref: '#/components/schemas/FTPServiceStatus' + webdav: + $ref: '#/components/schemas/WebDAVServiceStatus' + data_provider: + $ref: '#/components/schemas/DataProviderStatus' + defender: + $ref: '#/components/schemas/ServicesStatus_defender' + mfa: + $ref: '#/components/schemas/MFAStatus' + type: object + BanStatus: + example: + date_time: 2000-01-23T04:56:07.000+00:00 + properties: + date_time: + description: if null the host is not banned + format: date-time + nullable: true + type: string + type: object + ScoreStatus: + example: + score: 0 + properties: + score: + description: if 0 the host is not listed + type: integer + type: object + Share: + example: + allow_from: + - 192.0.2.0/24 + - 2001:db8::/32 + last_use_at: 1 + max_tokens: 5 + description: description + created_at: 0 + password: password + expires_at: 5 + updated_at: 6 + used_tokens: 2 + paths: + - /dir1 + - /dir2/file.txt + - /dir3/subdir + name: name + id: id + username: username + properties: + id: + description: auto-generated unique share identifier + type: string + name: + type: string + description: + description: optional description + type: string + scope: + $ref: '#/components/schemas/ShareScope' + paths: + description: paths to files or directories, for share scope write this array + must contain exactly one directory. Paths will not be validated on save + so you can also create them after creating the share + example: + - /dir1 + - /dir2/file.txt + - /dir3/subdir + items: + type: string + type: array + username: + type: string + created_at: + description: creation time as unix timestamp in milliseconds + format: int64 + type: integer + updated_at: + description: last update time as unix timestamp in milliseconds + format: int64 + type: integer + last_use_at: + description: last use time as unix timestamp in milliseconds + format: int64 + type: integer + expires_at: + description: optional share expiration, as unix timestamp in milliseconds. + 0 means no expiration + format: int64 + type: integer + password: + description: optional password to protect the share. The special value "[**redacted**]" + means that a password has been set, you can use this value if you want + to preserve the current password when you update a share + type: string + max_tokens: + description: maximum allowed access tokens. 0 means no limit + type: integer + used_tokens: + type: integer + allow_from: + description: Limit the share availability to these IP/Mask. IP/Mask must + be in CIDR notation as defined in RFC 4632 and RFC 4291, for example "192.0.2.0/24" + or "2001:db8::/32". An empty list means no restrictions + example: + - 192.0.2.0/24 + - 2001:db8::/32 + items: + type: string + type: array + type: object + BackupData: + example: + shares: + - allow_from: + - 192.0.2.0/24 + - 2001:db8::/32 + last_use_at: 1 + max_tokens: 5 + description: description + created_at: 0 + password: password + expires_at: 5 + updated_at: 6 + used_tokens: 2 + paths: + - /dir1 + - /dir2/file.txt + - /dir3/subdir + name: name + id: id + username: username + - allow_from: + - 192.0.2.0/24 + - 2001:db8::/32 + last_use_at: 1 + max_tokens: 5 + description: description + created_at: 0 + password: password + expires_at: 5 + updated_at: 6 + used_tokens: 2 + paths: + - /dir1 + - /dir2/file.txt + - /dir3/subdir + name: name + id: id + username: username + folders: + - mapped_path: mapped_path + used_quota_size: 6 + last_quota_update: 5 + name: name + used_quota_files: 1 + description: description + id: 1 + users: + - users + - users + filesystem: + gcsconfig: + bucket: bucket + storage_class: storage_class + credentials: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + automatic_credentials: 3 + key_prefix: folder/subfolder/ + acl: acl + sftpconfig: + endpoint: endpoint + password: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + disable_concurrent_reads: true + prefix: prefix + buffer_size: 2 + private_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + username: username + fingerprints: + - fingerprints + - fingerprints + cryptconfig: + passphrase: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + azblobconfig: + container: container + sas_url: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + endpoint: endpoint + upload_part_size: 3 + key_prefix: folder/subfolder/ + account_name: account_name + account_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + access_tier: "" + use_emulator: true + upload_concurrency: 7 + s3config: + upload_part_max_time: 6 + storage_class: storage_class + force_path_style: true + download_part_max_time: 6 + acl: acl + download_concurrency: 5 + bucket: bucket + endpoint: endpoint + upload_part_size: 1 + key_prefix: folder/subfolder/ + access_key: access_key + access_secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + download_part_size: 6 + region: region + upload_concurrency: 2 + - mapped_path: mapped_path + used_quota_size: 6 + last_quota_update: 5 + name: name + used_quota_files: 1 + description: description + id: 1 + users: + - users + - users + filesystem: + gcsconfig: + bucket: bucket + storage_class: storage_class + credentials: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + automatic_credentials: 3 + key_prefix: folder/subfolder/ + acl: acl + sftpconfig: + endpoint: endpoint + password: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + disable_concurrent_reads: true + prefix: prefix + buffer_size: 2 + private_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + username: username + fingerprints: + - fingerprints + - fingerprints + cryptconfig: + passphrase: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + azblobconfig: + container: container + sas_url: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + endpoint: endpoint + upload_part_size: 3 + key_prefix: folder/subfolder/ + account_name: account_name + account_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + access_tier: "" + use_emulator: true + upload_concurrency: 7 + s3config: + upload_part_max_time: 6 + storage_class: storage_class + force_path_style: true + download_part_max_time: 6 + acl: acl + download_concurrency: 5 + bucket: bucket + endpoint: endpoint + upload_part_size: 1 + key_prefix: folder/subfolder/ + access_key: access_key + access_secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + download_part_size: 6 + region: region + upload_concurrency: 2 + api_keys: + - expires_at: 5 + updated_at: 6 + last_use_at: 1 + name: name + created_at: 0 + description: description + admin: admin + id: id + user: user + key: key + - expires_at: 5 + updated_at: 6 + last_use_at: 1 + name: name + created_at: 0 + description: description + admin: admin + id: id + user: user + key: key + version: 7 + users: + - used_download_data_transfer: 1 + gid: 1210617418 + max_sessions: 2 + download_data_transfer: 1 + description: description + created_at: 4 + expiration_date: 1 + upload_data_transfer: 1 + public_keys: + - ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEUWwDwEWhTbF0MqAsp/oXK1HR2cElhM8oo1uVmL3ZeDKDiTm4ljMr92wfTgIGDqIoxmVqgYIkAOAhuykAVWBzc= + user@host + - ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEUWwDwEWhTbF0MqAsp/oXK1HR2cElhM8oo1uVmL3ZeDKDiTm4ljMr92wfTgIGDqIoxmVqgYIkAOAhuykAVWBzc= + user@host + virtual_folders: + - null + - null + uid: 1280358508 + used_quota_size: 3 + password: password + last_quota_update: 4 + updated_at: 5 + permissions: + /: + - '*' + /somedir: + - list + - download + used_quota_files: 2 + id: 1 + email: email + used_upload_data_transfer: 7 + last_login: 9 + home_dir: home_dir + total_data_transfer: 6 + filters: + denied_ip: + - 172.16.0.0/16 + allowed_ip: + - 192.0.2.0/24 + - 2001:db8::/32 + allow_api_key_auth: true + denied_login_methods: + - null + - null + web_client: + - null + - null + data_transfer_limits: + - sources: + - sources + - sources + download_data_transfer: 3 + total_data_transfer: 6 + upload_data_transfer: 6 + - sources: + - sources + - sources + download_data_transfer: 3 + total_data_transfer: 6 + upload_data_transfer: 6 + disable_fs_checks: false + file_patterns: + - path: path + denied_patterns: + - '*.zip' + allowed_patterns: + - '*.jpg' + - a*b?.png + deny_policy: 9 + - path: path + denied_patterns: + - '*.zip' + allowed_patterns: + - '*.jpg' + - a*b?.png + deny_policy: 9 + recovery_codes: + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + max_upload_file_size: 6 + tls_username: None + denied_protocols: + - null + - null + hooks: + external_auth_disabled: false + pre_login_disabled: false + check_password_disabled: false + bandwidth_limits: + - sources: + - sources + - sources + upload_bandwidth: 8 + download_bandwidth: 9 + - sources: + - sources + - sources + upload_bandwidth: 8 + download_bandwidth: 9 + filesystem: + gcsconfig: + bucket: bucket + storage_class: storage_class + credentials: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + automatic_credentials: 3 + key_prefix: folder/subfolder/ + acl: acl + sftpconfig: + endpoint: endpoint + password: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + disable_concurrent_reads: true + prefix: prefix + buffer_size: 2 + private_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + username: username + fingerprints: + - fingerprints + - fingerprints + cryptconfig: + passphrase: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + azblobconfig: + container: container + sas_url: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + endpoint: endpoint + upload_part_size: 3 + key_prefix: folder/subfolder/ + account_name: account_name + account_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + access_tier: "" + use_emulator: true + upload_concurrency: 7 + s3config: + upload_part_max_time: 6 + storage_class: storage_class + force_path_style: true + download_part_max_time: 6 + acl: acl + download_concurrency: 5 + bucket: bucket + endpoint: endpoint + upload_part_size: 1 + key_prefix: folder/subfolder/ + access_key: access_key + access_secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + download_part_size: 6 + region: region + upload_concurrency: 2 + quota_files: 9 + download_bandwidth: 1 + quota_size: 7 + additional_info: additional_info + upload_bandwidth: 7 + status: 6 + username: username + - used_download_data_transfer: 1 + gid: 1210617418 + max_sessions: 2 + download_data_transfer: 1 + description: description + created_at: 4 + expiration_date: 1 + upload_data_transfer: 1 + public_keys: + - ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEUWwDwEWhTbF0MqAsp/oXK1HR2cElhM8oo1uVmL3ZeDKDiTm4ljMr92wfTgIGDqIoxmVqgYIkAOAhuykAVWBzc= + user@host + - ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEUWwDwEWhTbF0MqAsp/oXK1HR2cElhM8oo1uVmL3ZeDKDiTm4ljMr92wfTgIGDqIoxmVqgYIkAOAhuykAVWBzc= + user@host + virtual_folders: + - null + - null + uid: 1280358508 + used_quota_size: 3 + password: password + last_quota_update: 4 + updated_at: 5 + permissions: + /: + - '*' + /somedir: + - list + - download + used_quota_files: 2 + id: 1 + email: email + used_upload_data_transfer: 7 + last_login: 9 + home_dir: home_dir + total_data_transfer: 6 + filters: + denied_ip: + - 172.16.0.0/16 + allowed_ip: + - 192.0.2.0/24 + - 2001:db8::/32 + allow_api_key_auth: true + denied_login_methods: + - null + - null + web_client: + - null + - null + data_transfer_limits: + - sources: + - sources + - sources + download_data_transfer: 3 + total_data_transfer: 6 + upload_data_transfer: 6 + - sources: + - sources + - sources + download_data_transfer: 3 + total_data_transfer: 6 + upload_data_transfer: 6 + disable_fs_checks: false + file_patterns: + - path: path + denied_patterns: + - '*.zip' + allowed_patterns: + - '*.jpg' + - a*b?.png + deny_policy: 9 + - path: path + denied_patterns: + - '*.zip' + allowed_patterns: + - '*.jpg' + - a*b?.png + deny_policy: 9 + recovery_codes: + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + max_upload_file_size: 6 + tls_username: None + denied_protocols: + - null + - null + hooks: + external_auth_disabled: false + pre_login_disabled: false + check_password_disabled: false + bandwidth_limits: + - sources: + - sources + - sources + upload_bandwidth: 8 + download_bandwidth: 9 + - sources: + - sources + - sources + upload_bandwidth: 8 + download_bandwidth: 9 + filesystem: + gcsconfig: + bucket: bucket + storage_class: storage_class + credentials: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + automatic_credentials: 3 + key_prefix: folder/subfolder/ + acl: acl + sftpconfig: + endpoint: endpoint + password: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + disable_concurrent_reads: true + prefix: prefix + buffer_size: 2 + private_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + username: username + fingerprints: + - fingerprints + - fingerprints + cryptconfig: + passphrase: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + azblobconfig: + container: container + sas_url: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + endpoint: endpoint + upload_part_size: 3 + key_prefix: folder/subfolder/ + account_name: account_name + account_key: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + access_tier: "" + use_emulator: true + upload_concurrency: 7 + s3config: + upload_part_max_time: 6 + storage_class: storage_class + force_path_style: true + download_part_max_time: 6 + acl: acl + download_concurrency: 5 + bucket: bucket + endpoint: endpoint + upload_part_size: 1 + key_prefix: folder/subfolder/ + access_key: access_key + access_secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + download_part_size: 6 + region: region + upload_concurrency: 2 + quota_files: 9 + download_bandwidth: 1 + quota_size: 7 + additional_info: additional_info + upload_bandwidth: 7 + status: 6 + username: username + admins: + - password: password + updated_at: 5 + additional_info: additional_info + permissions: + - null + - null + last_login: 5 + description: description + created_at: 1 + id: 1 + filters: + allow_list: + - 192.0.2.0/24 + - 2001:db8::/32 + recovery_codes: + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + allow_api_key_auth: true + email: email + status: 6 + username: username + - password: password + updated_at: 5 + additional_info: additional_info + permissions: + - null + - null + last_login: 5 + description: description + created_at: 1 + id: 1 + filters: + allow_list: + - 192.0.2.0/24 + - 2001:db8::/32 + recovery_codes: + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + - secret: + mode: 0 + additional_data: additional_data + payload: payload + key: key + status: Plain + used: true + allow_api_key_auth: true + email: email + status: 6 + username: username + properties: + users: + items: + $ref: '#/components/schemas/User' + type: array + folders: + items: + $ref: '#/components/schemas/BaseVirtualFolder' + type: array + admins: + items: + $ref: '#/components/schemas/Admin' + type: array + api_keys: + items: + $ref: '#/components/schemas/AuthAPIKey' + type: array + shares: + items: + $ref: '#/components/schemas/Share' + type: array + version: + type: integer + type: object + PwdChange: + example: + new_password: new_password + current_password: current_password + properties: + current_password: + type: string + new_password: + type: string + type: object + DirEntry: + example: + mode: 6 + size: 0 + name: name + last_modified: 2000-01-23T04:56:07.000+00:00 + properties: + name: + description: name of the file (or subdirectory) described by the entry. + This name is the final element of the path (the base name), not the entire + path + type: string + size: + description: file size, omitted for folders and non regular files + format: int64 + type: integer + mode: + description: | + File mode and permission bits. More details here: https://golang.org/pkg/io/fs/#FileMode. + Let's see some examples: + - for a directory mode&2147483648 != 0 + - for a symlink mode&134217728 != 0 + - for a regular file mode&2401763328 == 0 + type: integer + last_modified: + format: date-time + type: string + type: object + FsEvent: + example: + virtual_target_path: virtual_target_path + fs_target_path: fs_target_path + ip: ip + session_id: session_id + open_flags: open_flags + file_size: 6 + bucket: bucket + endpoint: endpoint + ssh_cmd: ssh_cmd + instance_id: instance_id + id: id + timestamp: 0 + username: username + fs_path: fs_path + virtual_path: virtual_path + properties: + id: + type: string + timestamp: + description: unix timestamp in nanoseconds + format: int64 + type: integer + action: + $ref: '#/components/schemas/FsEventAction' + username: + type: string + fs_path: + type: string + fs_target_path: + type: string + virtual_path: + type: string + virtual_target_path: + type: string + ssh_cmd: + type: string + file_size: + format: int64 + type: integer + status: + $ref: '#/components/schemas/FsEventStatus' + protocol: + $ref: '#/components/schemas/EventProtocols' + ip: + type: string + session_id: + type: string + fs_provider: + $ref: '#/components/schemas/FsProviders' + bucket: + type: string + endpoint: + type: string + open_flags: + type: string + instance_id: + type: string + type: object + ProviderEvent: + example: + instance_id: instance_id + ip: ip + object_name: object_name + id: id + timestamp: 0 + username: username + properties: + id: + type: string + timestamp: + description: unix timestamp in nanoseconds + format: int64 + type: integer + action: + $ref: '#/components/schemas/ProviderEventAction' + username: + type: string + ip: + type: string + object_type: + $ref: '#/components/schemas/ProviderEventObjectType' + object_name: + type: string + instance_id: + type: string + type: object + ApiResponse: + example: + message: message + error: error + properties: + message: + description: message, can be empty + type: string + error: + description: error description if any + type: string + type: object + VersionInfo: + example: + build_date: build_date + features: + - features + - features + version: version + commit_hash: commit_hash + properties: + version: + type: string + build_date: + type: string + commit_hash: + type: string + features: + description: Features for the current build. Available features are "portable", + "bolt", "mysql", "sqlite", "pgsql", "s3", "gcs", "metrics". If a feature + is available it has a "+" prefix, otherwise a "-" prefix + items: + type: string + type: array + type: object + Token: + example: + access_token: access_token + expires_at: 2000-01-23T04:56:07.000+00:00 + properties: + access_token: + type: string + expires_at: + format: date-time + type: string + type: object + inline_object: + properties: + filenames: + items: + format: binary + type: string + minItems: 1 + type: array + uniqueItems: true + type: object + inline_object_1: + properties: + config_name: + description: name of the configuration to use to generate the secret + type: string + type: object + inline_response_200: + example: + config_name: config_name + qr_code: qr_code + secret: secret + issuer: issuer + properties: + config_name: + type: string + issuer: + type: string + secret: + type: string + qr_code: + description: QR code png encoded as BASE64 + format: byte + type: string + type: object + inline_object_2: + properties: + config_name: + description: name of the configuration to use to validate the passcode + type: string + passcode: + description: passcode to validate + type: string + secret: + description: secret to use to validate the passcode + type: string + type: object + inline_object_3: + properties: + ip: + description: IPv4/IPv6 address to remove + type: string + type: object + inline_response_201: + example: + mesage: API key created. This is the only time the API key is visible, please + save it. + key: key + properties: + mesage: + example: API key created. This is the only time the API key is visible, + please save it. + type: string + key: + description: generated API key + type: string + type: object + inline_object_4: + properties: + code: + type: string + password: + type: string + type: object + inline_object_5: + properties: + code: + type: string + password: + type: string + type: object + inline_object_6: + properties: + config_name: + description: name of the configuration to use to generate the secret + type: string + type: object + inline_object_7: + properties: + config_name: + description: name of the configuration to use to validate the passcode + type: string + passcode: + description: passcode to validate + type: string + secret: + description: secret to use to validate the passcode + type: string + type: object + inline_object_8: + properties: + filenames: + items: + format: binary + type: string + minItems: 1 + type: array + uniqueItems: true + type: object + inline_object_9: + properties: + modification_time: + description: File modification time as unix timestamp in milliseconds + type: integer + type: object + UserTOTPConfig_allOf: + properties: + protocols: + description: TOTP will be required for the specified protocols. SSH protocol + (SFTP/SCP/SSH commands) will ask for the TOTP passcode if the client uses + keyboard interactive authentication. FTP has no standard way to support + two factor authentication, if you enable the FTP support, you have to + add the TOTP passcode after the password. For example if your password + is "password" and your one time passcode is "123456" you have to use "password123456" + as password. WebDAV is not supported since each single request must be + authenticated and a passcode cannot be reused. + items: + $ref: '#/components/schemas/MFAProtocols' + type: array + type: object + VirtualFolder_allOf: + properties: + virtual_path: + type: string + quota_size: + description: Quota as size in bytes. 0 menas unlimited, -1 means included + in user quota. Please note that quota is updated if files are added/removed + via SFTPGo otherwise a quota scan or a manual quota update is needed + format: int64 + type: integer + quota_files: + description: Quota as number of files. 0 menas unlimited, , -1 means included + in user quota. Please note that quota is updated if files are added/removed + via SFTPGo otherwise a quota scan or a manual quota update is needed + format: int32 + type: integer + required: + - virtual_path + type: object + ServicesStatus_defender: + example: + is_active: true + properties: + is_active: + type: boolean + type: object + securitySchemes: + BasicAuth: + scheme: basic + type: http + BearerAuth: + bearerFormat: JWT + scheme: bearer + type: http + APIKeyAuth: + description: API key to use for authentication. API key authentication is intrinsically + less secure than using a short lived JWT token. You should prefer API key + authentication only for machine-to-machine communications in trusted environments. + If no admin/user is associated to the provided key you need to add ".username" + at the end of the key. For example if your API key is "6ajKLwswLccVBGpZGv596G.ySAXc8vtp9hMiwAuaLtzof" + and you want to impersonate the admin with username "myadmin" you have to + use "6ajKLwswLccVBGpZGv596G.ySAXc8vtp9hMiwAuaLtzof.myadmin" as API key. When + using API key authentication you cannot manage API keys, update the impersonated + admin, change password or public keys for the impersonated user. + in: header + name: X-SFTPGO-API-KEY + type: apiKey diff --git a/server/common/sftpgo/v2/openapi/api_admins.go b/server/common/sftpgo/v2/openapi/api_admins.go new file mode 100644 index 00000000..7bccecea --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_admins.go @@ -0,0 +1,2911 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +// AdminsApiService AdminsApi service +type AdminsApiService service + +type AdminsApiApiAddAdminRequest struct { + ctx context.Context + ApiService *AdminsApiService + admin *Admin +} + +func (r AdminsApiApiAddAdminRequest) Admin(admin Admin) AdminsApiApiAddAdminRequest { + r.admin = &admin + return r +} + +func (r AdminsApiApiAddAdminRequest) Execute() (*Admin, *http.Response, error) { + return r.ApiService.AddAdminExecute(r) +} + +/* +AddAdmin Add admin + +Adds a new admin. Recovery codes and TOTP configuration cannot be set using this API: each admin must use the specific APIs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiAddAdminRequest +*/ +func (a *AdminsApiService) AddAdmin(ctx context.Context) AdminsApiApiAddAdminRequest { + return AdminsApiApiAddAdminRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return Admin +func (a *AdminsApiService) AddAdminExecute(r AdminsApiApiAddAdminRequest) (*Admin, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Admin + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.AddAdmin") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admins" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.admin == nil { + return localVarReturnValue, nil, reportError("admin is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.admin + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiAdminForgotPasswordRequest struct { + ctx context.Context + ApiService *AdminsApiService + username string +} + + +func (r AdminsApiApiAdminForgotPasswordRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.AdminForgotPasswordExecute(r) +} + +/* +AdminForgotPassword Send a password reset code by email + +You must set up an SMTP server and the account must have a valid email address, in which case SFTPGo will send a code via email to reset the password. If the specified admin does not exist, the request will be silently ignored (a success response will be returned) to avoid disclosing existing admins + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the admin username + @return AdminsApiApiAdminForgotPasswordRequest +*/ +func (a *AdminsApiService) AdminForgotPassword(ctx context.Context, username string) AdminsApiApiAdminForgotPasswordRequest { + return AdminsApiApiAdminForgotPasswordRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *AdminsApiService) AdminForgotPasswordExecute(r AdminsApiApiAdminForgotPasswordRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.AdminForgotPassword") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admins/{username}/forgot-password" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiAdminResetPasswordRequest struct { + ctx context.Context + ApiService *AdminsApiService + username string + inlineObject4 *InlineObject4 +} + +func (r AdminsApiApiAdminResetPasswordRequest) InlineObject4(inlineObject4 InlineObject4) AdminsApiApiAdminResetPasswordRequest { + r.inlineObject4 = &inlineObject4 + return r +} + +func (r AdminsApiApiAdminResetPasswordRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.AdminResetPasswordExecute(r) +} + +/* +AdminResetPassword Reset the password + +Set a new password using the code received via email + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the admin username + @return AdminsApiApiAdminResetPasswordRequest +*/ +func (a *AdminsApiService) AdminResetPassword(ctx context.Context, username string) AdminsApiApiAdminResetPasswordRequest { + return AdminsApiApiAdminResetPasswordRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *AdminsApiService) AdminResetPasswordExecute(r AdminsApiApiAdminResetPasswordRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.AdminResetPassword") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admins/{username}/reset-password" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inlineObject4 == nil { + return localVarReturnValue, nil, reportError("inlineObject4 is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inlineObject4 + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiChangeAdminPasswordRequest struct { + ctx context.Context + ApiService *AdminsApiService + pwdChange *PwdChange +} + +func (r AdminsApiApiChangeAdminPasswordRequest) PwdChange(pwdChange PwdChange) AdminsApiApiChangeAdminPasswordRequest { + r.pwdChange = &pwdChange + return r +} + +func (r AdminsApiApiChangeAdminPasswordRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.ChangeAdminPasswordExecute(r) +} + +/* +ChangeAdminPassword Change admin password + +Changes the password for the logged in admin + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiChangeAdminPasswordRequest +*/ +func (a *AdminsApiService) ChangeAdminPassword(ctx context.Context) AdminsApiApiChangeAdminPasswordRequest { + return AdminsApiApiChangeAdminPasswordRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *AdminsApiService) ChangeAdminPasswordExecute(r AdminsApiApiChangeAdminPasswordRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.ChangeAdminPassword") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/changepwd" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.pwdChange == nil { + return localVarReturnValue, nil, reportError("pwdChange is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.pwdChange + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiChangeAdminPasswordDeprecatedRequest struct { + ctx context.Context + ApiService *AdminsApiService + pwdChange *PwdChange +} + +func (r AdminsApiApiChangeAdminPasswordDeprecatedRequest) PwdChange(pwdChange PwdChange) AdminsApiApiChangeAdminPasswordDeprecatedRequest { + r.pwdChange = &pwdChange + return r +} + +func (r AdminsApiApiChangeAdminPasswordDeprecatedRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.ChangeAdminPasswordDeprecatedExecute(r) +} + +/* +ChangeAdminPasswordDeprecated Change admin password + +Changes the password for the logged in admin. Please use '/admin/changepwd' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiChangeAdminPasswordDeprecatedRequest + +Deprecated +*/ +func (a *AdminsApiService) ChangeAdminPasswordDeprecated(ctx context.Context) AdminsApiApiChangeAdminPasswordDeprecatedRequest { + return AdminsApiApiChangeAdminPasswordDeprecatedRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +// Deprecated +func (a *AdminsApiService) ChangeAdminPasswordDeprecatedExecute(r AdminsApiApiChangeAdminPasswordDeprecatedRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.ChangeAdminPasswordDeprecated") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/changepwd/admin" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.pwdChange == nil { + return localVarReturnValue, nil, reportError("pwdChange is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.pwdChange + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiDeleteAdminRequest struct { + ctx context.Context + ApiService *AdminsApiService + username string +} + + +func (r AdminsApiApiDeleteAdminRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.DeleteAdminExecute(r) +} + +/* +DeleteAdmin Delete admin + +Deletes an existing admin + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the admin username + @return AdminsApiApiDeleteAdminRequest +*/ +func (a *AdminsApiService) DeleteAdmin(ctx context.Context, username string) AdminsApiApiDeleteAdminRequest { + return AdminsApiApiDeleteAdminRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *AdminsApiService) DeleteAdminExecute(r AdminsApiApiDeleteAdminRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.DeleteAdmin") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admins/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiDisableAdmin2faRequest struct { + ctx context.Context + ApiService *AdminsApiService + username string +} + + +func (r AdminsApiApiDisableAdmin2faRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.DisableAdmin2faExecute(r) +} + +/* +DisableAdmin2fa Disable second factor authentication + +Disables second factor authentication for the given admin. This API must be used if the admin loses access to their second factor auth device and has no recovery codes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the admin username + @return AdminsApiApiDisableAdmin2faRequest +*/ +func (a *AdminsApiService) DisableAdmin2fa(ctx context.Context, username string) AdminsApiApiDisableAdmin2faRequest { + return AdminsApiApiDisableAdmin2faRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *AdminsApiService) DisableAdmin2faExecute(r AdminsApiApiDisableAdmin2faRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.DisableAdmin2fa") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admins/{username}/2fa/disable" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiGenerateAdminRecoveryCodesRequest struct { + ctx context.Context + ApiService *AdminsApiService +} + + +func (r AdminsApiApiGenerateAdminRecoveryCodesRequest) Execute() ([]string, *http.Response, error) { + return r.ApiService.GenerateAdminRecoveryCodesExecute(r) +} + +/* +GenerateAdminRecoveryCodes Generate recovery codes + +Generates new recovery codes for the logged in admin. Generating new recovery codes you automatically invalidate old ones + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiGenerateAdminRecoveryCodesRequest +*/ +func (a *AdminsApiService) GenerateAdminRecoveryCodes(ctx context.Context) AdminsApiApiGenerateAdminRecoveryCodesRequest { + return AdminsApiApiGenerateAdminRecoveryCodesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []string +func (a *AdminsApiService) GenerateAdminRecoveryCodesExecute(r AdminsApiApiGenerateAdminRecoveryCodesRequest) ([]string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.GenerateAdminRecoveryCodes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/2fa/recoverycodes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiGenerateAdminTotpSecretRequest struct { + ctx context.Context + ApiService *AdminsApiService + inlineObject1 *InlineObject1 +} + +func (r AdminsApiApiGenerateAdminTotpSecretRequest) InlineObject1(inlineObject1 InlineObject1) AdminsApiApiGenerateAdminTotpSecretRequest { + r.inlineObject1 = &inlineObject1 + return r +} + +func (r AdminsApiApiGenerateAdminTotpSecretRequest) Execute() (*InlineResponse200, *http.Response, error) { + return r.ApiService.GenerateAdminTotpSecretExecute(r) +} + +/* +GenerateAdminTotpSecret Generate a new TOTP secret + +Generates a new TOTP secret, including the QR code as png, using the specified configuration for the logged in admin + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiGenerateAdminTotpSecretRequest +*/ +func (a *AdminsApiService) GenerateAdminTotpSecret(ctx context.Context) AdminsApiApiGenerateAdminTotpSecretRequest { + return AdminsApiApiGenerateAdminTotpSecretRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return InlineResponse200 +func (a *AdminsApiService) GenerateAdminTotpSecretExecute(r AdminsApiApiGenerateAdminTotpSecretRequest) (*InlineResponse200, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InlineResponse200 + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.GenerateAdminTotpSecret") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/totp/generate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inlineObject1 == nil { + return localVarReturnValue, nil, reportError("inlineObject1 is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inlineObject1 + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiGetAdminByUsernameRequest struct { + ctx context.Context + ApiService *AdminsApiService + username string +} + + +func (r AdminsApiApiGetAdminByUsernameRequest) Execute() (*Admin, *http.Response, error) { + return r.ApiService.GetAdminByUsernameExecute(r) +} + +/* +GetAdminByUsername Find admins by username + +Returns the admin with the given username, if it exists. For security reasons the hashed password is omitted in the response + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the admin username + @return AdminsApiApiGetAdminByUsernameRequest +*/ +func (a *AdminsApiService) GetAdminByUsername(ctx context.Context, username string) AdminsApiApiGetAdminByUsernameRequest { + return AdminsApiApiGetAdminByUsernameRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return Admin +func (a *AdminsApiService) GetAdminByUsernameExecute(r AdminsApiApiGetAdminByUsernameRequest) (*Admin, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Admin + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.GetAdminByUsername") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admins/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiGetAdminProfileRequest struct { + ctx context.Context + ApiService *AdminsApiService +} + + +func (r AdminsApiApiGetAdminProfileRequest) Execute() (*AdminProfile, *http.Response, error) { + return r.ApiService.GetAdminProfileExecute(r) +} + +/* +GetAdminProfile Get admin profile + +Returns the profile for the logged in admin + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiGetAdminProfileRequest +*/ +func (a *AdminsApiService) GetAdminProfile(ctx context.Context) AdminsApiApiGetAdminProfileRequest { + return AdminsApiApiGetAdminProfileRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return AdminProfile +func (a *AdminsApiService) GetAdminProfileExecute(r AdminsApiApiGetAdminProfileRequest) (*AdminProfile, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AdminProfile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.GetAdminProfile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/profile" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiGetAdminRecoveryCodesRequest struct { + ctx context.Context + ApiService *AdminsApiService +} + + +func (r AdminsApiApiGetAdminRecoveryCodesRequest) Execute() ([]RecoveryCode, *http.Response, error) { + return r.ApiService.GetAdminRecoveryCodesExecute(r) +} + +/* +GetAdminRecoveryCodes Get recovery codes + +Returns the recovery codes for the logged in admin. Recovery codes can be used if the admin loses access to their second factor auth device. Recovery codes are returned unencrypted + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiGetAdminRecoveryCodesRequest +*/ +func (a *AdminsApiService) GetAdminRecoveryCodes(ctx context.Context) AdminsApiApiGetAdminRecoveryCodesRequest { + return AdminsApiApiGetAdminRecoveryCodesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []RecoveryCode +func (a *AdminsApiService) GetAdminRecoveryCodesExecute(r AdminsApiApiGetAdminRecoveryCodesRequest) ([]RecoveryCode, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []RecoveryCode + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.GetAdminRecoveryCodes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/2fa/recoverycodes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiGetAdminTotpConfigsRequest struct { + ctx context.Context + ApiService *AdminsApiService +} + + +func (r AdminsApiApiGetAdminTotpConfigsRequest) Execute() ([]TOTPConfig, *http.Response, error) { + return r.ApiService.GetAdminTotpConfigsExecute(r) +} + +/* +GetAdminTotpConfigs Get available TOTP configuration + +Returns the available TOTP configurations for the logged in admin + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiGetAdminTotpConfigsRequest +*/ +func (a *AdminsApiService) GetAdminTotpConfigs(ctx context.Context) AdminsApiApiGetAdminTotpConfigsRequest { + return AdminsApiApiGetAdminTotpConfigsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []TOTPConfig +func (a *AdminsApiService) GetAdminTotpConfigsExecute(r AdminsApiApiGetAdminTotpConfigsRequest) ([]TOTPConfig, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []TOTPConfig + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.GetAdminTotpConfigs") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/totp/configs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiGetAdminsRequest struct { + ctx context.Context + ApiService *AdminsApiService + offset *int32 + limit *int32 + order *string +} + +func (r AdminsApiApiGetAdminsRequest) Offset(offset int32) AdminsApiApiGetAdminsRequest { + r.offset = &offset + return r +} +// The maximum number of items to return. Max value is 500, default is 100 +func (r AdminsApiApiGetAdminsRequest) Limit(limit int32) AdminsApiApiGetAdminsRequest { + r.limit = &limit + return r +} +// Ordering admins by username. Default ASC +func (r AdminsApiApiGetAdminsRequest) Order(order string) AdminsApiApiGetAdminsRequest { + r.order = &order + return r +} + +func (r AdminsApiApiGetAdminsRequest) Execute() ([]Admin, *http.Response, error) { + return r.ApiService.GetAdminsExecute(r) +} + +/* +GetAdmins Get admins + +Returns an array with one or more admins. For security reasons hashed passwords are omitted in the response + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiGetAdminsRequest +*/ +func (a *AdminsApiService) GetAdmins(ctx context.Context) AdminsApiApiGetAdminsRequest { + return AdminsApiApiGetAdminsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []Admin +func (a *AdminsApiService) GetAdminsExecute(r AdminsApiApiGetAdminsRequest) ([]Admin, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Admin + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.GetAdmins") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admins" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.offset != nil { + localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) + } + if r.order != nil { + localVarQueryParams.Add("order", parameterToString(*r.order, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiSaveAdminTotpConfigRequest struct { + ctx context.Context + ApiService *AdminsApiService + adminTOTPConfig *AdminTOTPConfig +} + +func (r AdminsApiApiSaveAdminTotpConfigRequest) AdminTOTPConfig(adminTOTPConfig AdminTOTPConfig) AdminsApiApiSaveAdminTotpConfigRequest { + r.adminTOTPConfig = &adminTOTPConfig + return r +} + +func (r AdminsApiApiSaveAdminTotpConfigRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.SaveAdminTotpConfigExecute(r) +} + +/* +SaveAdminTotpConfig Save a TOTP config + +Saves the specified TOTP config for the logged in admin + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiSaveAdminTotpConfigRequest +*/ +func (a *AdminsApiService) SaveAdminTotpConfig(ctx context.Context) AdminsApiApiSaveAdminTotpConfigRequest { + return AdminsApiApiSaveAdminTotpConfigRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *AdminsApiService) SaveAdminTotpConfigExecute(r AdminsApiApiSaveAdminTotpConfigRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.SaveAdminTotpConfig") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/totp/save" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.adminTOTPConfig == nil { + return localVarReturnValue, nil, reportError("adminTOTPConfig is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.adminTOTPConfig + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiUpdateAdminRequest struct { + ctx context.Context + ApiService *AdminsApiService + username string + admin *Admin +} + +func (r AdminsApiApiUpdateAdminRequest) Admin(admin Admin) AdminsApiApiUpdateAdminRequest { + r.admin = &admin + return r +} + +func (r AdminsApiApiUpdateAdminRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UpdateAdminExecute(r) +} + +/* +UpdateAdmin Update admin + +Updates an existing admin. Recovery codes and TOTP configuration cannot be set/updated using this API: each admin must use the specific APIs. You are not allowed to update the admin impersonated using an API key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the admin username + @return AdminsApiApiUpdateAdminRequest +*/ +func (a *AdminsApiService) UpdateAdmin(ctx context.Context, username string) AdminsApiApiUpdateAdminRequest { + return AdminsApiApiUpdateAdminRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *AdminsApiService) UpdateAdminExecute(r AdminsApiApiUpdateAdminRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.UpdateAdmin") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admins/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.admin == nil { + return localVarReturnValue, nil, reportError("admin is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.admin + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiUpdateAdminProfileRequest struct { + ctx context.Context + ApiService *AdminsApiService + adminProfile *AdminProfile +} + +func (r AdminsApiApiUpdateAdminProfileRequest) AdminProfile(adminProfile AdminProfile) AdminsApiApiUpdateAdminProfileRequest { + r.adminProfile = &adminProfile + return r +} + +func (r AdminsApiApiUpdateAdminProfileRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UpdateAdminProfileExecute(r) +} + +/* +UpdateAdminProfile Update admin profile + +Allows to update the profile for the logged in admin + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiUpdateAdminProfileRequest +*/ +func (a *AdminsApiService) UpdateAdminProfile(ctx context.Context) AdminsApiApiUpdateAdminProfileRequest { + return AdminsApiApiUpdateAdminProfileRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *AdminsApiService) UpdateAdminProfileExecute(r AdminsApiApiUpdateAdminProfileRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.UpdateAdminProfile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/profile" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.adminProfile == nil { + return localVarReturnValue, nil, reportError("adminProfile is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.adminProfile + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type AdminsApiApiValidateAdminTotpSecretRequest struct { + ctx context.Context + ApiService *AdminsApiService + inlineObject2 *InlineObject2 +} + +func (r AdminsApiApiValidateAdminTotpSecretRequest) InlineObject2(inlineObject2 InlineObject2) AdminsApiApiValidateAdminTotpSecretRequest { + r.inlineObject2 = &inlineObject2 + return r +} + +func (r AdminsApiApiValidateAdminTotpSecretRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.ValidateAdminTotpSecretExecute(r) +} + +/* +ValidateAdminTotpSecret Validate a one time authentication code + +Checks if the given authentication code can be validated using the specified secret and config name + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return AdminsApiApiValidateAdminTotpSecretRequest +*/ +func (a *AdminsApiService) ValidateAdminTotpSecret(ctx context.Context) AdminsApiApiValidateAdminTotpSecretRequest { + return AdminsApiApiValidateAdminTotpSecretRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *AdminsApiService) ValidateAdminTotpSecretExecute(r AdminsApiApiValidateAdminTotpSecretRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminsApiService.ValidateAdminTotpSecret") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/totp/validate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inlineObject2 == nil { + return localVarReturnValue, nil, reportError("inlineObject2 is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inlineObject2 + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_api_keys.go b/server/common/sftpgo/v2/openapi/api_api_keys.go new file mode 100644 index 00000000..c41520ee --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_api_keys.go @@ -0,0 +1,851 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +// APIKeysApiService APIKeysApi service +type APIKeysApiService service + +type APIKeysApiApiAddApiKeyRequest struct { + ctx context.Context + ApiService *APIKeysApiService + authAPIKey *AuthAPIKey +} + +func (r APIKeysApiApiAddApiKeyRequest) AuthAPIKey(authAPIKey AuthAPIKey) APIKeysApiApiAddApiKeyRequest { + r.authAPIKey = &authAPIKey + return r +} + +func (r APIKeysApiApiAddApiKeyRequest) Execute() (*InlineResponse201, *http.Response, error) { + return r.ApiService.AddApiKeyExecute(r) +} + +/* +AddApiKey Add API key + +Adds a new API key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return APIKeysApiApiAddApiKeyRequest +*/ +func (a *APIKeysApiService) AddApiKey(ctx context.Context) APIKeysApiApiAddApiKeyRequest { + return APIKeysApiApiAddApiKeyRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return InlineResponse201 +func (a *APIKeysApiService) AddApiKeyExecute(r APIKeysApiApiAddApiKeyRequest) (*InlineResponse201, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InlineResponse201 + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "APIKeysApiService.AddApiKey") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/apikeys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.authAPIKey == nil { + return localVarReturnValue, nil, reportError("authAPIKey is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.authAPIKey + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type APIKeysApiApiDeleteApiKeyRequest struct { + ctx context.Context + ApiService *APIKeysApiService + id string +} + + +func (r APIKeysApiApiDeleteApiKeyRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.DeleteApiKeyExecute(r) +} + +/* +DeleteApiKey Delete API key + +Deletes an existing API key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id the key id + @return APIKeysApiApiDeleteApiKeyRequest +*/ +func (a *APIKeysApiService) DeleteApiKey(ctx context.Context, id string) APIKeysApiApiDeleteApiKeyRequest { + return APIKeysApiApiDeleteApiKeyRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *APIKeysApiService) DeleteApiKeyExecute(r APIKeysApiApiDeleteApiKeyRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "APIKeysApiService.DeleteApiKey") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/apikeys/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type APIKeysApiApiGetApiKeyByIdRequest struct { + ctx context.Context + ApiService *APIKeysApiService + id string +} + + +func (r APIKeysApiApiGetApiKeyByIdRequest) Execute() (*AuthAPIKey, *http.Response, error) { + return r.ApiService.GetApiKeyByIdExecute(r) +} + +/* +GetApiKeyById Find API key by id + +Returns the API key with the given id, if it exists. For security reasons the hashed key is omitted in the response + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id the key id + @return APIKeysApiApiGetApiKeyByIdRequest +*/ +func (a *APIKeysApiService) GetApiKeyById(ctx context.Context, id string) APIKeysApiApiGetApiKeyByIdRequest { + return APIKeysApiApiGetApiKeyByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return AuthAPIKey +func (a *APIKeysApiService) GetApiKeyByIdExecute(r APIKeysApiApiGetApiKeyByIdRequest) (*AuthAPIKey, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AuthAPIKey + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "APIKeysApiService.GetApiKeyById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/apikeys/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type APIKeysApiApiGetApiKeysRequest struct { + ctx context.Context + ApiService *APIKeysApiService + offset *int32 + limit *int32 + order *string +} + +func (r APIKeysApiApiGetApiKeysRequest) Offset(offset int32) APIKeysApiApiGetApiKeysRequest { + r.offset = &offset + return r +} +// The maximum number of items to return. Max value is 500, default is 100 +func (r APIKeysApiApiGetApiKeysRequest) Limit(limit int32) APIKeysApiApiGetApiKeysRequest { + r.limit = &limit + return r +} +// Ordering API keys by id. Default ASC +func (r APIKeysApiApiGetApiKeysRequest) Order(order string) APIKeysApiApiGetApiKeysRequest { + r.order = &order + return r +} + +func (r APIKeysApiApiGetApiKeysRequest) Execute() ([]AuthAPIKey, *http.Response, error) { + return r.ApiService.GetApiKeysExecute(r) +} + +/* +GetApiKeys Get API keys + +Returns an array with one or more API keys. For security reasons hashed keys are omitted in the response + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return APIKeysApiApiGetApiKeysRequest +*/ +func (a *APIKeysApiService) GetApiKeys(ctx context.Context) APIKeysApiApiGetApiKeysRequest { + return APIKeysApiApiGetApiKeysRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []AuthAPIKey +func (a *APIKeysApiService) GetApiKeysExecute(r APIKeysApiApiGetApiKeysRequest) ([]AuthAPIKey, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []AuthAPIKey + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "APIKeysApiService.GetApiKeys") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/apikeys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.offset != nil { + localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) + } + if r.order != nil { + localVarQueryParams.Add("order", parameterToString(*r.order, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type APIKeysApiApiUpdateApiKeyRequest struct { + ctx context.Context + ApiService *APIKeysApiService + id string + authAPIKey *AuthAPIKey +} + +func (r APIKeysApiApiUpdateApiKeyRequest) AuthAPIKey(authAPIKey AuthAPIKey) APIKeysApiApiUpdateApiKeyRequest { + r.authAPIKey = &authAPIKey + return r +} + +func (r APIKeysApiApiUpdateApiKeyRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UpdateApiKeyExecute(r) +} + +/* +UpdateApiKey Update API key + +Updates an existing API key. You cannot update the key itself, the creation date and the last use + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id the key id + @return APIKeysApiApiUpdateApiKeyRequest +*/ +func (a *APIKeysApiService) UpdateApiKey(ctx context.Context, id string) APIKeysApiApiUpdateApiKeyRequest { + return APIKeysApiApiUpdateApiKeyRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *APIKeysApiService) UpdateApiKeyExecute(r APIKeysApiApiUpdateApiKeyRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "APIKeysApiService.UpdateApiKey") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/apikeys/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.authAPIKey == nil { + return localVarReturnValue, nil, reportError("authAPIKey is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.authAPIKey + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_connections.go b/server/common/sftpgo/v2/openapi/api_connections.go new file mode 100644 index 00000000..89696996 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_connections.go @@ -0,0 +1,344 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +// ConnectionsApiService ConnectionsApi service +type ConnectionsApiService service + +type ConnectionsApiApiCloseConnectionRequest struct { + ctx context.Context + ApiService *ConnectionsApiService + connectionID string +} + + +func (r ConnectionsApiApiCloseConnectionRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.CloseConnectionExecute(r) +} + +/* +CloseConnection Close connection + +Terminates an active connection + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connectionID ID of the connection to close + @return ConnectionsApiApiCloseConnectionRequest +*/ +func (a *ConnectionsApiService) CloseConnection(ctx context.Context, connectionID string) ConnectionsApiApiCloseConnectionRequest { + return ConnectionsApiApiCloseConnectionRequest{ + ApiService: a, + ctx: ctx, + connectionID: connectionID, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *ConnectionsApiService) CloseConnectionExecute(r ConnectionsApiApiCloseConnectionRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConnectionsApiService.CloseConnection") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections/{connectionID}" + localVarPath = strings.Replace(localVarPath, "{"+"connectionID"+"}", url.PathEscape(parameterToString(r.connectionID, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ConnectionsApiApiGetConnectionsRequest struct { + ctx context.Context + ApiService *ConnectionsApiService +} + + +func (r ConnectionsApiApiGetConnectionsRequest) Execute() ([]ConnectionStatus, *http.Response, error) { + return r.ApiService.GetConnectionsExecute(r) +} + +/* +GetConnections Get connections details + +Returns the active users and info about their current uploads/downloads + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ConnectionsApiApiGetConnectionsRequest +*/ +func (a *ConnectionsApiService) GetConnections(ctx context.Context) ConnectionsApiApiGetConnectionsRequest { + return ConnectionsApiApiGetConnectionsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ConnectionStatus +func (a *ConnectionsApiService) GetConnectionsExecute(r ConnectionsApiApiGetConnectionsRequest) ([]ConnectionStatus, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ConnectionStatus + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConnectionsApiService.GetConnections") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_data_retention.go b/server/common/sftpgo/v2/openapi/api_data_retention.go new file mode 100644 index 00000000..b9321e4e --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_data_retention.go @@ -0,0 +1,384 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +// DataRetentionApiService DataRetentionApi service +type DataRetentionApiService service + +type DataRetentionApiApiGetUsersRetentionChecksRequest struct { + ctx context.Context + ApiService *DataRetentionApiService +} + + +func (r DataRetentionApiApiGetUsersRetentionChecksRequest) Execute() ([]RetentionCheck, *http.Response, error) { + return r.ApiService.GetUsersRetentionChecksExecute(r) +} + +/* +GetUsersRetentionChecks Get retention checks + +Returns the active retention checks + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return DataRetentionApiApiGetUsersRetentionChecksRequest +*/ +func (a *DataRetentionApiService) GetUsersRetentionChecks(ctx context.Context) DataRetentionApiApiGetUsersRetentionChecksRequest { + return DataRetentionApiApiGetUsersRetentionChecksRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []RetentionCheck +func (a *DataRetentionApiService) GetUsersRetentionChecksExecute(r DataRetentionApiApiGetUsersRetentionChecksRequest) ([]RetentionCheck, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []RetentionCheck + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataRetentionApiService.GetUsersRetentionChecks") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/retention/users/checks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type DataRetentionApiApiStartUserRetentionCheckRequest struct { + ctx context.Context + ApiService *DataRetentionApiService + username string + folderRetention *[]FolderRetention + notifications *[]RetentionCheckNotification +} + +// Defines virtual paths to check and their retention time in hours +func (r DataRetentionApiApiStartUserRetentionCheckRequest) FolderRetention(folderRetention []FolderRetention) DataRetentionApiApiStartUserRetentionCheckRequest { + r.folderRetention = &folderRetention + return r +} +// specify how to notify results +func (r DataRetentionApiApiStartUserRetentionCheckRequest) Notifications(notifications []RetentionCheckNotification) DataRetentionApiApiStartUserRetentionCheckRequest { + r.notifications = ¬ifications + return r +} + +func (r DataRetentionApiApiStartUserRetentionCheckRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.StartUserRetentionCheckExecute(r) +} + +/* +StartUserRetentionCheck Start a retention check + +Starts a new retention check for the given user. If a retention check for this user is already active a 409 status code is returned + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the username + @return DataRetentionApiApiStartUserRetentionCheckRequest +*/ +func (a *DataRetentionApiService) StartUserRetentionCheck(ctx context.Context, username string) DataRetentionApiApiStartUserRetentionCheckRequest { + return DataRetentionApiApiStartUserRetentionCheckRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *DataRetentionApiService) StartUserRetentionCheckExecute(r DataRetentionApiApiStartUserRetentionCheckRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataRetentionApiService.StartUserRetentionCheck") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/retention/users/{username}/check" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.folderRetention == nil { + return localVarReturnValue, nil, reportError("folderRetention is required and must be specified") + } + + if r.notifications != nil { + localVarQueryParams.Add("notifications", parameterToString(*r.notifications, "csv")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.folderRetention + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_defender.go b/server/common/sftpgo/v2/openapi/api_defender.go new file mode 100644 index 00000000..ee86c227 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_defender.go @@ -0,0 +1,1051 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +// DefenderApiService DefenderApi service +type DefenderApiService service + +type DefenderApiApiDeleteDefenderHostByIdRequest struct { + ctx context.Context + ApiService *DefenderApiService + id string +} + + +func (r DefenderApiApiDeleteDefenderHostByIdRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.DeleteDefenderHostByIdExecute(r) +} + +/* +DeleteDefenderHostById Removes a host from the defender lists + +Unbans the specified host or clears its violations + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id host id + @return DefenderApiApiDeleteDefenderHostByIdRequest +*/ +func (a *DefenderApiService) DeleteDefenderHostById(ctx context.Context, id string) DefenderApiApiDeleteDefenderHostByIdRequest { + return DefenderApiApiDeleteDefenderHostByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *DefenderApiService) DeleteDefenderHostByIdExecute(r DefenderApiApiDeleteDefenderHostByIdRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefenderApiService.DeleteDefenderHostById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/defender/hosts/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type DefenderApiApiGetBanTimeRequest struct { + ctx context.Context + ApiService *DefenderApiService + ip *string +} + +// IPv4/IPv6 address +func (r DefenderApiApiGetBanTimeRequest) Ip(ip string) DefenderApiApiGetBanTimeRequest { + r.ip = &ip + return r +} + +func (r DefenderApiApiGetBanTimeRequest) Execute() (*BanStatus, *http.Response, error) { + return r.ApiService.GetBanTimeExecute(r) +} + +/* +GetBanTime Get ban time + +Deprecated, please use '/defender/hosts', '/defender/hosts/{id}' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return DefenderApiApiGetBanTimeRequest + +Deprecated +*/ +func (a *DefenderApiService) GetBanTime(ctx context.Context) DefenderApiApiGetBanTimeRequest { + return DefenderApiApiGetBanTimeRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return BanStatus +// Deprecated +func (a *DefenderApiService) GetBanTimeExecute(r DefenderApiApiGetBanTimeRequest) (*BanStatus, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BanStatus + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefenderApiService.GetBanTime") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/defender/bantime" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.ip == nil { + return localVarReturnValue, nil, reportError("ip is required and must be specified") + } + + localVarQueryParams.Add("ip", parameterToString(*r.ip, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type DefenderApiApiGetDefenderHostByIdRequest struct { + ctx context.Context + ApiService *DefenderApiService + id string +} + + +func (r DefenderApiApiGetDefenderHostByIdRequest) Execute() (*DefenderEntry, *http.Response, error) { + return r.ApiService.GetDefenderHostByIdExecute(r) +} + +/* +GetDefenderHostById Get host by id + +Returns the host with the given id, if it exists + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id host id + @return DefenderApiApiGetDefenderHostByIdRequest +*/ +func (a *DefenderApiService) GetDefenderHostById(ctx context.Context, id string) DefenderApiApiGetDefenderHostByIdRequest { + return DefenderApiApiGetDefenderHostByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return DefenderEntry +func (a *DefenderApiService) GetDefenderHostByIdExecute(r DefenderApiApiGetDefenderHostByIdRequest) (*DefenderEntry, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DefenderEntry + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefenderApiService.GetDefenderHostById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/defender/hosts/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type DefenderApiApiGetDefenderHostsRequest struct { + ctx context.Context + ApiService *DefenderApiService +} + + +func (r DefenderApiApiGetDefenderHostsRequest) Execute() ([]DefenderEntry, *http.Response, error) { + return r.ApiService.GetDefenderHostsExecute(r) +} + +/* +GetDefenderHosts Get hosts + +Returns hosts that are banned or for which some violations have been detected + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return DefenderApiApiGetDefenderHostsRequest +*/ +func (a *DefenderApiService) GetDefenderHosts(ctx context.Context) DefenderApiApiGetDefenderHostsRequest { + return DefenderApiApiGetDefenderHostsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []DefenderEntry +func (a *DefenderApiService) GetDefenderHostsExecute(r DefenderApiApiGetDefenderHostsRequest) ([]DefenderEntry, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []DefenderEntry + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefenderApiService.GetDefenderHosts") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/defender/hosts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type DefenderApiApiGetScoreRequest struct { + ctx context.Context + ApiService *DefenderApiService + ip *string +} + +// IPv4/IPv6 address +func (r DefenderApiApiGetScoreRequest) Ip(ip string) DefenderApiApiGetScoreRequest { + r.ip = &ip + return r +} + +func (r DefenderApiApiGetScoreRequest) Execute() (*ScoreStatus, *http.Response, error) { + return r.ApiService.GetScoreExecute(r) +} + +/* +GetScore Get score + +Deprecated, please use '/defender/hosts', '/defender/hosts/{id}' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return DefenderApiApiGetScoreRequest + +Deprecated +*/ +func (a *DefenderApiService) GetScore(ctx context.Context) DefenderApiApiGetScoreRequest { + return DefenderApiApiGetScoreRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ScoreStatus +// Deprecated +func (a *DefenderApiService) GetScoreExecute(r DefenderApiApiGetScoreRequest) (*ScoreStatus, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ScoreStatus + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefenderApiService.GetScore") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/defender/score" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.ip == nil { + return localVarReturnValue, nil, reportError("ip is required and must be specified") + } + + localVarQueryParams.Add("ip", parameterToString(*r.ip, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type DefenderApiApiUnbanHostRequest struct { + ctx context.Context + ApiService *DefenderApiService + inlineObject3 *InlineObject3 +} + +func (r DefenderApiApiUnbanHostRequest) InlineObject3(inlineObject3 InlineObject3) DefenderApiApiUnbanHostRequest { + r.inlineObject3 = &inlineObject3 + return r +} + +func (r DefenderApiApiUnbanHostRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UnbanHostExecute(r) +} + +/* +UnbanHost Unban + +Deprecated, please use '/defender/hosts/{id}' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return DefenderApiApiUnbanHostRequest + +Deprecated +*/ +func (a *DefenderApiService) UnbanHost(ctx context.Context) DefenderApiApiUnbanHostRequest { + return DefenderApiApiUnbanHostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +// Deprecated +func (a *DefenderApiService) UnbanHostExecute(r DefenderApiApiUnbanHostRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefenderApiService.UnbanHost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/defender/unban" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inlineObject3 == nil { + return localVarReturnValue, nil, reportError("inlineObject3 is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inlineObject3 + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_events.go b/server/common/sftpgo/v2/openapi/api_events.go new file mode 100644 index 00000000..f80d83d6 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_events.go @@ -0,0 +1,583 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" +) + +// Linger please +var ( + _ context.Context +) + +// EventsApiService EventsApi service +type EventsApiService service + +type EventsApiApiGetFsEventsRequest struct { + ctx context.Context + ApiService *EventsApiService + startTimestamp *int64 + endTimestamp *int64 + actions *[]FsEventAction + username *string + ip *string + sshCmd *string + fsProvider *FsProviders + bucket *string + endpoint *string + protocols *[]EventProtocols + statuses *[]FsEventStatus + instanceIds *[]string + excludeIds *[]string + limit *int32 + order *string +} + +// the event timestamp, unix timestamp in nanoseconds, must be greater than or equal to the specified one. 0 or missing means omit this filter +func (r EventsApiApiGetFsEventsRequest) StartTimestamp(startTimestamp int64) EventsApiApiGetFsEventsRequest { + r.startTimestamp = &startTimestamp + return r +} +// the event timestamp, unix timestamp in nanoseconds, must be less than or equal to the specified one. 0 or missing means omit this filter +func (r EventsApiApiGetFsEventsRequest) EndTimestamp(endTimestamp int64) EventsApiApiGetFsEventsRequest { + r.endTimestamp = &endTimestamp + return r +} +// the event action must be included among those specified. Empty or missing means omit this filter. Actions must be specified comma separated +func (r EventsApiApiGetFsEventsRequest) Actions(actions []FsEventAction) EventsApiApiGetFsEventsRequest { + r.actions = &actions + return r +} +// the event username must be the same as the one specified. Empty or missing means omit this filter +func (r EventsApiApiGetFsEventsRequest) Username(username string) EventsApiApiGetFsEventsRequest { + r.username = &username + return r +} +// the event IP must be the same as the one specified. Empty or missing means omit this filter +func (r EventsApiApiGetFsEventsRequest) Ip(ip string) EventsApiApiGetFsEventsRequest { + r.ip = &ip + return r +} +// the event SSH command must be the same as the one specified. Empty or missing means omit this filter +func (r EventsApiApiGetFsEventsRequest) SshCmd(sshCmd string) EventsApiApiGetFsEventsRequest { + r.sshCmd = &sshCmd + return r +} +// the event filesystem provider must be the same as the one specified. Empty or missing means omit this filter +func (r EventsApiApiGetFsEventsRequest) FsProvider(fsProvider FsProviders) EventsApiApiGetFsEventsRequest { + r.fsProvider = &fsProvider + return r +} +// the bucket must be the same as the one specified. Empty or missing means omit this filter +func (r EventsApiApiGetFsEventsRequest) Bucket(bucket string) EventsApiApiGetFsEventsRequest { + r.bucket = &bucket + return r +} +// the endpoint must be the same as the one specified. Empty or missing means omit this filter +func (r EventsApiApiGetFsEventsRequest) Endpoint(endpoint string) EventsApiApiGetFsEventsRequest { + r.endpoint = &endpoint + return r +} +// the event protocol must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated +func (r EventsApiApiGetFsEventsRequest) Protocols(protocols []EventProtocols) EventsApiApiGetFsEventsRequest { + r.protocols = &protocols + return r +} +// the event status must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated +func (r EventsApiApiGetFsEventsRequest) Statuses(statuses []FsEventStatus) EventsApiApiGetFsEventsRequest { + r.statuses = &statuses + return r +} +// the event instance id must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated +func (r EventsApiApiGetFsEventsRequest) InstanceIds(instanceIds []string) EventsApiApiGetFsEventsRequest { + r.instanceIds = &instanceIds + return r +} +// the event id must not be included among those specified. This is useful for cursor based pagination. Empty or missing means omit this filter. Values must be specified comma separated +func (r EventsApiApiGetFsEventsRequest) ExcludeIds(excludeIds []string) EventsApiApiGetFsEventsRequest { + r.excludeIds = &excludeIds + return r +} +// The maximum number of items to return. Max value is 500, default is 100 +func (r EventsApiApiGetFsEventsRequest) Limit(limit int32) EventsApiApiGetFsEventsRequest { + r.limit = &limit + return r +} +// Ordering events by timestamp. Default DESC +func (r EventsApiApiGetFsEventsRequest) Order(order string) EventsApiApiGetFsEventsRequest { + r.order = &order + return r +} + +func (r EventsApiApiGetFsEventsRequest) Execute() ([]FsEvent, *http.Response, error) { + return r.ApiService.GetFsEventsExecute(r) +} + +/* +GetFsEvents Get filesystem events + +Returns an array with one or more filesystem events applying the specified filters. This API is only available if you configure an "eventsearcher" plugin + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return EventsApiApiGetFsEventsRequest +*/ +func (a *EventsApiService) GetFsEvents(ctx context.Context) EventsApiApiGetFsEventsRequest { + return EventsApiApiGetFsEventsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []FsEvent +func (a *EventsApiService) GetFsEventsExecute(r EventsApiApiGetFsEventsRequest) ([]FsEvent, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []FsEvent + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EventsApiService.GetFsEvents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/events/fs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.startTimestamp != nil { + localVarQueryParams.Add("start_timestamp", parameterToString(*r.startTimestamp, "")) + } + if r.endTimestamp != nil { + localVarQueryParams.Add("end_timestamp", parameterToString(*r.endTimestamp, "")) + } + if r.actions != nil { + localVarQueryParams.Add("actions", parameterToString(*r.actions, "csv")) + } + if r.username != nil { + localVarQueryParams.Add("username", parameterToString(*r.username, "")) + } + if r.ip != nil { + localVarQueryParams.Add("ip", parameterToString(*r.ip, "")) + } + if r.sshCmd != nil { + localVarQueryParams.Add("ssh_cmd", parameterToString(*r.sshCmd, "")) + } + if r.fsProvider != nil { + localVarQueryParams.Add("fs_provider", parameterToString(*r.fsProvider, "")) + } + if r.bucket != nil { + localVarQueryParams.Add("bucket", parameterToString(*r.bucket, "")) + } + if r.endpoint != nil { + localVarQueryParams.Add("endpoint", parameterToString(*r.endpoint, "")) + } + if r.protocols != nil { + localVarQueryParams.Add("protocols", parameterToString(*r.protocols, "csv")) + } + if r.statuses != nil { + localVarQueryParams.Add("statuses", parameterToString(*r.statuses, "csv")) + } + if r.instanceIds != nil { + localVarQueryParams.Add("instance_ids", parameterToString(*r.instanceIds, "csv")) + } + if r.excludeIds != nil { + localVarQueryParams.Add("exclude_ids", parameterToString(*r.excludeIds, "csv")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) + } + if r.order != nil { + localVarQueryParams.Add("order", parameterToString(*r.order, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type EventsApiApiGetProviderEventsRequest struct { + ctx context.Context + ApiService *EventsApiService + startTimestamp *int64 + endTimestamp *int64 + actions *[]ProviderEventAction + username *string + ip *string + objectName *string + objectTypes *[]ProviderEventObjectType + instanceIds *[]string + excludeIds *[]string + limit *int32 + order *string +} + +// the event timestamp, unix timestamp in nanoseconds, must be greater than or equal to the specified one. 0 or missing means omit this filter +func (r EventsApiApiGetProviderEventsRequest) StartTimestamp(startTimestamp int64) EventsApiApiGetProviderEventsRequest { + r.startTimestamp = &startTimestamp + return r +} +// the event timestamp, unix timestamp in nanoseconds, must be less than or equal to the specified one. 0 or missing means omit this filter +func (r EventsApiApiGetProviderEventsRequest) EndTimestamp(endTimestamp int64) EventsApiApiGetProviderEventsRequest { + r.endTimestamp = &endTimestamp + return r +} +// the event action must be included among those specified. Empty or missing means omit this filter. Actions must be specified comma separated +func (r EventsApiApiGetProviderEventsRequest) Actions(actions []ProviderEventAction) EventsApiApiGetProviderEventsRequest { + r.actions = &actions + return r +} +// the event username must be the same as the one specified. Empty or missing means omit this filter +func (r EventsApiApiGetProviderEventsRequest) Username(username string) EventsApiApiGetProviderEventsRequest { + r.username = &username + return r +} +// the event IP must be the same as the one specified. Empty or missing means omit this filter +func (r EventsApiApiGetProviderEventsRequest) Ip(ip string) EventsApiApiGetProviderEventsRequest { + r.ip = &ip + return r +} +// the event object name must be the same as the one specified. Empty or missing means omit this filter +func (r EventsApiApiGetProviderEventsRequest) ObjectName(objectName string) EventsApiApiGetProviderEventsRequest { + r.objectName = &objectName + return r +} +// the event object type must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated +func (r EventsApiApiGetProviderEventsRequest) ObjectTypes(objectTypes []ProviderEventObjectType) EventsApiApiGetProviderEventsRequest { + r.objectTypes = &objectTypes + return r +} +// the event instance id must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated +func (r EventsApiApiGetProviderEventsRequest) InstanceIds(instanceIds []string) EventsApiApiGetProviderEventsRequest { + r.instanceIds = &instanceIds + return r +} +// the event id must not be included among those specified. This is useful for cursor based pagination. Empty or missing means omit this filter. Values must be specified comma separated +func (r EventsApiApiGetProviderEventsRequest) ExcludeIds(excludeIds []string) EventsApiApiGetProviderEventsRequest { + r.excludeIds = &excludeIds + return r +} +// The maximum number of items to return. Max value is 500, default is 100 +func (r EventsApiApiGetProviderEventsRequest) Limit(limit int32) EventsApiApiGetProviderEventsRequest { + r.limit = &limit + return r +} +// Ordering events by timestamp. Default DESC +func (r EventsApiApiGetProviderEventsRequest) Order(order string) EventsApiApiGetProviderEventsRequest { + r.order = &order + return r +} + +func (r EventsApiApiGetProviderEventsRequest) Execute() ([]ProviderEvent, *http.Response, error) { + return r.ApiService.GetProviderEventsExecute(r) +} + +/* +GetProviderEvents Get provider events + +Returns an array with one or more provider events applying the specified filters. This API is only available if you configure an "eventsearcher" plugin + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return EventsApiApiGetProviderEventsRequest +*/ +func (a *EventsApiService) GetProviderEvents(ctx context.Context) EventsApiApiGetProviderEventsRequest { + return EventsApiApiGetProviderEventsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ProviderEvent +func (a *EventsApiService) GetProviderEventsExecute(r EventsApiApiGetProviderEventsRequest) ([]ProviderEvent, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ProviderEvent + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EventsApiService.GetProviderEvents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/events/provider" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.startTimestamp != nil { + localVarQueryParams.Add("start_timestamp", parameterToString(*r.startTimestamp, "")) + } + if r.endTimestamp != nil { + localVarQueryParams.Add("end_timestamp", parameterToString(*r.endTimestamp, "")) + } + if r.actions != nil { + localVarQueryParams.Add("actions", parameterToString(*r.actions, "csv")) + } + if r.username != nil { + localVarQueryParams.Add("username", parameterToString(*r.username, "")) + } + if r.ip != nil { + localVarQueryParams.Add("ip", parameterToString(*r.ip, "")) + } + if r.objectName != nil { + localVarQueryParams.Add("object_name", parameterToString(*r.objectName, "")) + } + if r.objectTypes != nil { + localVarQueryParams.Add("object_types", parameterToString(*r.objectTypes, "csv")) + } + if r.instanceIds != nil { + localVarQueryParams.Add("instance_ids", parameterToString(*r.instanceIds, "csv")) + } + if r.excludeIds != nil { + localVarQueryParams.Add("exclude_ids", parameterToString(*r.excludeIds, "csv")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) + } + if r.order != nil { + localVarQueryParams.Add("order", parameterToString(*r.order, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_folders.go b/server/common/sftpgo/v2/openapi/api_folders.go new file mode 100644 index 00000000..1243b6dc --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_folders.go @@ -0,0 +1,921 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +// FoldersApiService FoldersApi service +type FoldersApiService service + +type FoldersApiApiAddFolderRequest struct { + ctx context.Context + ApiService *FoldersApiService + baseVirtualFolder *BaseVirtualFolder +} + +func (r FoldersApiApiAddFolderRequest) BaseVirtualFolder(baseVirtualFolder BaseVirtualFolder) FoldersApiApiAddFolderRequest { + r.baseVirtualFolder = &baseVirtualFolder + return r +} + +func (r FoldersApiApiAddFolderRequest) Execute() (*BaseVirtualFolder, *http.Response, error) { + return r.ApiService.AddFolderExecute(r) +} + +/* +AddFolder Add folder + +Adds a new folder. A quota scan is required to update the used files/size + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FoldersApiApiAddFolderRequest +*/ +func (a *FoldersApiService) AddFolder(ctx context.Context) FoldersApiApiAddFolderRequest { + return FoldersApiApiAddFolderRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return BaseVirtualFolder +func (a *FoldersApiService) AddFolderExecute(r FoldersApiApiAddFolderRequest) (*BaseVirtualFolder, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BaseVirtualFolder + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FoldersApiService.AddFolder") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/folders" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.baseVirtualFolder == nil { + return localVarReturnValue, nil, reportError("baseVirtualFolder is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.baseVirtualFolder + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type FoldersApiApiDeleteFolderRequest struct { + ctx context.Context + ApiService *FoldersApiService + name string +} + + +func (r FoldersApiApiDeleteFolderRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.DeleteFolderExecute(r) +} + +/* +DeleteFolder Delete folder + +Deletes an existing folder + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param name folder name + @return FoldersApiApiDeleteFolderRequest +*/ +func (a *FoldersApiService) DeleteFolder(ctx context.Context, name string) FoldersApiApiDeleteFolderRequest { + return FoldersApiApiDeleteFolderRequest{ + ApiService: a, + ctx: ctx, + name: name, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *FoldersApiService) DeleteFolderExecute(r FoldersApiApiDeleteFolderRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FoldersApiService.DeleteFolder") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/folders/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(parameterToString(r.name, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type FoldersApiApiGetFolderByNameRequest struct { + ctx context.Context + ApiService *FoldersApiService + name string +} + + +func (r FoldersApiApiGetFolderByNameRequest) Execute() (*BaseVirtualFolder, *http.Response, error) { + return r.ApiService.GetFolderByNameExecute(r) +} + +/* +GetFolderByName Find folders by name + +Returns the folder with the given name if it exists. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param name folder name + @return FoldersApiApiGetFolderByNameRequest +*/ +func (a *FoldersApiService) GetFolderByName(ctx context.Context, name string) FoldersApiApiGetFolderByNameRequest { + return FoldersApiApiGetFolderByNameRequest{ + ApiService: a, + ctx: ctx, + name: name, + } +} + +// Execute executes the request +// @return BaseVirtualFolder +func (a *FoldersApiService) GetFolderByNameExecute(r FoldersApiApiGetFolderByNameRequest) (*BaseVirtualFolder, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BaseVirtualFolder + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FoldersApiService.GetFolderByName") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/folders/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(parameterToString(r.name, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type FoldersApiApiGetFoldersRequest struct { + ctx context.Context + ApiService *FoldersApiService + offset *int32 + limit *int32 + order *string +} + +func (r FoldersApiApiGetFoldersRequest) Offset(offset int32) FoldersApiApiGetFoldersRequest { + r.offset = &offset + return r +} +// The maximum number of items to return. Max value is 500, default is 100 +func (r FoldersApiApiGetFoldersRequest) Limit(limit int32) FoldersApiApiGetFoldersRequest { + r.limit = &limit + return r +} +// Ordering folders by path. Default ASC +func (r FoldersApiApiGetFoldersRequest) Order(order string) FoldersApiApiGetFoldersRequest { + r.order = &order + return r +} + +func (r FoldersApiApiGetFoldersRequest) Execute() ([]BaseVirtualFolder, *http.Response, error) { + return r.ApiService.GetFoldersExecute(r) +} + +/* +GetFolders Get folders + +Returns an array with one or more folders + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return FoldersApiApiGetFoldersRequest +*/ +func (a *FoldersApiService) GetFolders(ctx context.Context) FoldersApiApiGetFoldersRequest { + return FoldersApiApiGetFoldersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []BaseVirtualFolder +func (a *FoldersApiService) GetFoldersExecute(r FoldersApiApiGetFoldersRequest) ([]BaseVirtualFolder, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []BaseVirtualFolder + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FoldersApiService.GetFolders") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/folders" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.offset != nil { + localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) + } + if r.order != nil { + localVarQueryParams.Add("order", parameterToString(*r.order, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type FoldersApiApiUpdateFolderRequest struct { + ctx context.Context + ApiService *FoldersApiService + name string + baseVirtualFolder *BaseVirtualFolder +} + +func (r FoldersApiApiUpdateFolderRequest) BaseVirtualFolder(baseVirtualFolder BaseVirtualFolder) FoldersApiApiUpdateFolderRequest { + r.baseVirtualFolder = &baseVirtualFolder + return r +} + +func (r FoldersApiApiUpdateFolderRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UpdateFolderExecute(r) +} + +/* +UpdateFolder Update folder + +Updates an existing folder + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param name folder name + @return FoldersApiApiUpdateFolderRequest +*/ +func (a *FoldersApiService) UpdateFolder(ctx context.Context, name string) FoldersApiApiUpdateFolderRequest { + return FoldersApiApiUpdateFolderRequest{ + ApiService: a, + ctx: ctx, + name: name, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *FoldersApiService) UpdateFolderExecute(r FoldersApiApiUpdateFolderRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FoldersApiService.UpdateFolder") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/folders/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(parameterToString(r.name, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.baseVirtualFolder == nil { + return localVarReturnValue, nil, reportError("baseVirtualFolder is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.baseVirtualFolder + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_healthcheck.go b/server/common/sftpgo/v2/openapi/api_healthcheck.go new file mode 100644 index 00000000..0e87e477 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_healthcheck.go @@ -0,0 +1,127 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" +) + +// Linger please +var ( + _ context.Context +) + +// HealthcheckApiService HealthcheckApi service +type HealthcheckApiService service + +type HealthcheckApiApiHealthzRequest struct { + ctx context.Context + ApiService *HealthcheckApiService +} + + +func (r HealthcheckApiApiHealthzRequest) Execute() (string, *http.Response, error) { + return r.ApiService.HealthzExecute(r) +} + +/* +Healthz health check + +This endpoint can be used to check if the application is running and responding to requests + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return HealthcheckApiApiHealthzRequest +*/ +func (a *HealthcheckApiService) Healthz(ctx context.Context) HealthcheckApiApiHealthzRequest { + return HealthcheckApiApiHealthzRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *HealthcheckApiService) HealthzExecute(r HealthcheckApiApiHealthzRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HealthcheckApiService.Healthz") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/healthz" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_maintenance.go b/server/common/sftpgo/v2/openapi/api_maintenance.go new file mode 100644 index 00000000..6ff915dd --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_maintenance.go @@ -0,0 +1,905 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" +) + +// Linger please +var ( + _ context.Context +) + +// MaintenanceApiService MaintenanceApi service +type MaintenanceApiService service + +type MaintenanceApiApiDumpdataRequest struct { + ctx context.Context + ApiService *MaintenanceApiService + outputFile *string + outputData *int32 + indent *int32 +} + +// Path for the file to write the JSON serialized data to. This path is relative to the configured \"backups_path\". If this file already exists it will be overwritten. To return the backup as response body set `output_data` to true instead. +func (r MaintenanceApiApiDumpdataRequest) OutputFile(outputFile string) MaintenanceApiApiDumpdataRequest { + r.outputFile = &outputFile + return r +} +// output data: * `0` or any other value != 1, the backup will be saved to a file on the server, `output_file` is required * `1` the backup will be returned as response body +func (r MaintenanceApiApiDumpdataRequest) OutputData(outputData int32) MaintenanceApiApiDumpdataRequest { + r.outputData = &outputData + return r +} +// indent: * `0` no indentation. This is the default * `1` format the output JSON +func (r MaintenanceApiApiDumpdataRequest) Indent(indent int32) MaintenanceApiApiDumpdataRequest { + r.indent = &indent + return r +} + +func (r MaintenanceApiApiDumpdataRequest) Execute() (*BackupData, *http.Response, error) { + return r.ApiService.DumpdataExecute(r) +} + +/* +Dumpdata Dump data + +Backups data as data provider independent JSON. The backup can be saved in a local file on the server, to avoid exposing sensitive data over the network, or returned as response body. The output of dumpdata can be used as input for loaddata + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MaintenanceApiApiDumpdataRequest +*/ +func (a *MaintenanceApiService) Dumpdata(ctx context.Context) MaintenanceApiApiDumpdataRequest { + return MaintenanceApiApiDumpdataRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return BackupData +func (a *MaintenanceApiService) DumpdataExecute(r MaintenanceApiApiDumpdataRequest) (*BackupData, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BackupData + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MaintenanceApiService.Dumpdata") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/dumpdata" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.outputFile != nil { + localVarQueryParams.Add("output-file", parameterToString(*r.outputFile, "")) + } + if r.outputData != nil { + localVarQueryParams.Add("output-data", parameterToString(*r.outputData, "")) + } + if r.indent != nil { + localVarQueryParams.Add("indent", parameterToString(*r.indent, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type MaintenanceApiApiGetStatusRequest struct { + ctx context.Context + ApiService *MaintenanceApiService +} + + +func (r MaintenanceApiApiGetStatusRequest) Execute() (*ServicesStatus, *http.Response, error) { + return r.ApiService.GetStatusExecute(r) +} + +/* +GetStatus Get status + +Retrieves the status of the active services + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MaintenanceApiApiGetStatusRequest +*/ +func (a *MaintenanceApiService) GetStatus(ctx context.Context) MaintenanceApiApiGetStatusRequest { + return MaintenanceApiApiGetStatusRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ServicesStatus +func (a *MaintenanceApiService) GetStatusExecute(r MaintenanceApiApiGetStatusRequest) (*ServicesStatus, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServicesStatus + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MaintenanceApiService.GetStatus") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/status" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type MaintenanceApiApiGetVersionRequest struct { + ctx context.Context + ApiService *MaintenanceApiService +} + + +func (r MaintenanceApiApiGetVersionRequest) Execute() (*VersionInfo, *http.Response, error) { + return r.ApiService.GetVersionExecute(r) +} + +/* +GetVersion Get version details + +Returns version details such as the version number, build date, commit hash and enabled features + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MaintenanceApiApiGetVersionRequest +*/ +func (a *MaintenanceApiService) GetVersion(ctx context.Context) MaintenanceApiApiGetVersionRequest { + return MaintenanceApiApiGetVersionRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return VersionInfo +func (a *MaintenanceApiService) GetVersionExecute(r MaintenanceApiApiGetVersionRequest) (*VersionInfo, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VersionInfo + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MaintenanceApiService.GetVersion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/version" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type MaintenanceApiApiLoaddataFromFileRequest struct { + ctx context.Context + ApiService *MaintenanceApiService + inputFile *string + scanQuota *int32 + mode *int32 +} + +// Path for the file to read the JSON serialized data from. This can be an absolute path or a path relative to the configured \"backups_path\". The max allowed file size is 10MB +func (r MaintenanceApiApiLoaddataFromFileRequest) InputFile(inputFile string) MaintenanceApiApiLoaddataFromFileRequest { + r.inputFile = &inputFile + return r +} +// Quota scan: * `0` no quota scan is done, the imported users/folders will have used_quota_size and used_quota_files = 0 or the existing values if they already exists. This is the default * `1` scan quota * `2` scan quota if the user has quota restrictions required: false +func (r MaintenanceApiApiLoaddataFromFileRequest) ScanQuota(scanQuota int32) MaintenanceApiApiLoaddataFromFileRequest { + r.scanQuota = &scanQuota + return r +} +// Mode: * `0` New objects are added, existing ones are updated. This is the default * `1` New objects are added, existing ones are not modified * `2` New objects are added, existing ones are updated and connected users are disconnected and so forced to use the new configuration +func (r MaintenanceApiApiLoaddataFromFileRequest) Mode(mode int32) MaintenanceApiApiLoaddataFromFileRequest { + r.mode = &mode + return r +} + +func (r MaintenanceApiApiLoaddataFromFileRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.LoaddataFromFileExecute(r) +} + +/* +LoaddataFromFile Load data from path + +Restores SFTPGo data from a JSON backup file on the server. Objects will be restored one by one and the restore is stopped if a object cannot be added or updated, so it could happen a partial restore + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MaintenanceApiApiLoaddataFromFileRequest +*/ +func (a *MaintenanceApiService) LoaddataFromFile(ctx context.Context) MaintenanceApiApiLoaddataFromFileRequest { + return MaintenanceApiApiLoaddataFromFileRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *MaintenanceApiService) LoaddataFromFileExecute(r MaintenanceApiApiLoaddataFromFileRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MaintenanceApiService.LoaddataFromFile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/loaddata" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inputFile == nil { + return localVarReturnValue, nil, reportError("inputFile is required and must be specified") + } + + if r.scanQuota != nil { + localVarQueryParams.Add("scan-quota", parameterToString(*r.scanQuota, "")) + } + if r.mode != nil { + localVarQueryParams.Add("mode", parameterToString(*r.mode, "")) + } + localVarQueryParams.Add("input-file", parameterToString(*r.inputFile, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type MaintenanceApiApiLoaddataFromRequestBodyRequest struct { + ctx context.Context + ApiService *MaintenanceApiService + backupData *BackupData + scanQuota *int32 + mode *int32 +} + +func (r MaintenanceApiApiLoaddataFromRequestBodyRequest) BackupData(backupData BackupData) MaintenanceApiApiLoaddataFromRequestBodyRequest { + r.backupData = &backupData + return r +} +// Quota scan: * `0` no quota scan is done, the imported users/folders will have used_quota_size and used_quota_files = 0 or the existing values if they already exists. This is the default * `1` scan quota * `2` scan quota if the user has quota restrictions required: false +func (r MaintenanceApiApiLoaddataFromRequestBodyRequest) ScanQuota(scanQuota int32) MaintenanceApiApiLoaddataFromRequestBodyRequest { + r.scanQuota = &scanQuota + return r +} +// Mode: * `0` New objects are added, existing ones are updated. This is the default * `1` New objects are added, existing ones are not modified * `2` New objects are added, existing ones are updated and connected users are disconnected and so forced to use the new configuration +func (r MaintenanceApiApiLoaddataFromRequestBodyRequest) Mode(mode int32) MaintenanceApiApiLoaddataFromRequestBodyRequest { + r.mode = &mode + return r +} + +func (r MaintenanceApiApiLoaddataFromRequestBodyRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.LoaddataFromRequestBodyExecute(r) +} + +/* +LoaddataFromRequestBody Load data + +Restores SFTPGo data from a JSON backup. Objects will be restored one by one and the restore is stopped if a object cannot be added or updated, so it could happen a partial restore + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MaintenanceApiApiLoaddataFromRequestBodyRequest +*/ +func (a *MaintenanceApiService) LoaddataFromRequestBody(ctx context.Context) MaintenanceApiApiLoaddataFromRequestBodyRequest { + return MaintenanceApiApiLoaddataFromRequestBodyRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *MaintenanceApiService) LoaddataFromRequestBodyExecute(r MaintenanceApiApiLoaddataFromRequestBodyRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MaintenanceApiService.LoaddataFromRequestBody") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/loaddata" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.backupData == nil { + return localVarReturnValue, nil, reportError("backupData is required and must be specified") + } + + if r.scanQuota != nil { + localVarQueryParams.Add("scan-quota", parameterToString(*r.scanQuota, "")) + } + if r.mode != nil { + localVarQueryParams.Add("mode", parameterToString(*r.mode, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.backupData + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_metadata.go b/server/common/sftpgo/v2/openapi/api_metadata.go new file mode 100644 index 00000000..f91db5ac --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_metadata.go @@ -0,0 +1,364 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +// MetadataApiService MetadataApi service +type MetadataApiService service + +type MetadataApiApiGetUsersMetadataChecksRequest struct { + ctx context.Context + ApiService *MetadataApiService +} + + +func (r MetadataApiApiGetUsersMetadataChecksRequest) Execute() ([]MetadataCheck, *http.Response, error) { + return r.ApiService.GetUsersMetadataChecksExecute(r) +} + +/* +GetUsersMetadataChecks Get metadata checks + +Returns the active metadata checks + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return MetadataApiApiGetUsersMetadataChecksRequest +*/ +func (a *MetadataApiService) GetUsersMetadataChecks(ctx context.Context) MetadataApiApiGetUsersMetadataChecksRequest { + return MetadataApiApiGetUsersMetadataChecksRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []MetadataCheck +func (a *MetadataApiService) GetUsersMetadataChecksExecute(r MetadataApiApiGetUsersMetadataChecksRequest) ([]MetadataCheck, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []MetadataCheck + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetadataApiService.GetUsersMetadataChecks") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metadata/users/checks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type MetadataApiApiStartUserMetadataCheckRequest struct { + ctx context.Context + ApiService *MetadataApiService + username string +} + + +func (r MetadataApiApiStartUserMetadataCheckRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.StartUserMetadataCheckExecute(r) +} + +/* +StartUserMetadataCheck Start a metadata check + +Starts a new metadata check for the given user. A metadata check requires a metadata plugin and removes the metadata associated to missing items (for example objects deleted outside SFTPGo). If a metadata check for this user is already active a 409 status code is returned. Metadata are stored for cloud storage backends. This API does nothing for other backends or if no metadata plugin is configured + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the username + @return MetadataApiApiStartUserMetadataCheckRequest +*/ +func (a *MetadataApiService) StartUserMetadataCheck(ctx context.Context, username string) MetadataApiApiStartUserMetadataCheckRequest { + return MetadataApiApiStartUserMetadataCheckRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *MetadataApiService) StartUserMetadataCheckExecute(r MetadataApiApiStartUserMetadataCheckRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetadataApiService.StartUserMetadataCheck") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metadata/users/{username}/check" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_public_shares.go b/server/common/sftpgo/v2/openapi/api_public_shares.go new file mode 100644 index 00000000..1801d081 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_public_shares.go @@ -0,0 +1,885 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "os" +) + +// Linger please +var ( + _ context.Context +) + +// PublicSharesApiService PublicSharesApi service +type PublicSharesApiService service + +type PublicSharesApiApiDownloadShareFileRequest struct { + ctx context.Context + ApiService *PublicSharesApiService + id string + path *string + inline *string +} + +// Path to the file to download. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" +func (r PublicSharesApiApiDownloadShareFileRequest) Path(path string) PublicSharesApiApiDownloadShareFileRequest { + r.path = &path + return r +} +// If set, the response will not have the Content-Disposition header set to `attachment` +func (r PublicSharesApiApiDownloadShareFileRequest) Inline(inline string) PublicSharesApiApiDownloadShareFileRequest { + r.inline = &inline + return r +} + +func (r PublicSharesApiApiDownloadShareFileRequest) Execute() (**os.File, *http.Response, error) { + return r.ApiService.DownloadShareFileExecute(r) +} + +/* +DownloadShareFile Download a single file + +Returns the file contents as response body. The share must have exactly one path defined and it must be a directory for this to work + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id the share id + @return PublicSharesApiApiDownloadShareFileRequest +*/ +func (a *PublicSharesApiService) DownloadShareFile(ctx context.Context, id string) PublicSharesApiApiDownloadShareFileRequest { + return PublicSharesApiApiDownloadShareFileRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return *os.File +func (a *PublicSharesApiService) DownloadShareFileExecute(r PublicSharesApiApiDownloadShareFileRequest) (**os.File, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue **os.File + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PublicSharesApiService.DownloadShareFile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/shares/{id}/files" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, nil, reportError("path is required and must be specified") + } + + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + if r.inline != nil { + localVarQueryParams.Add("inline", parameterToString(*r.inline, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"*/*", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type PublicSharesApiApiGetShareRequest struct { + ctx context.Context + ApiService *PublicSharesApiService + id string + compress *bool +} + +func (r PublicSharesApiApiGetShareRequest) Compress(compress bool) PublicSharesApiApiGetShareRequest { + r.compress = &compress + return r +} + +func (r PublicSharesApiApiGetShareRequest) Execute() (**os.File, *http.Response, error) { + return r.ApiService.GetShareExecute(r) +} + +/* +GetShare Download shared files and folders as a single zip file + +A zip file, containing the shared files and folders, will be generated on the fly and returned as response body. Only folders and regular files will be included in the zip. The share must be defined with the read scope and the associated user must have list and download permissions + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id the share id + @return PublicSharesApiApiGetShareRequest +*/ +func (a *PublicSharesApiService) GetShare(ctx context.Context, id string) PublicSharesApiApiGetShareRequest { + return PublicSharesApiApiGetShareRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return *os.File +func (a *PublicSharesApiService) GetShareExecute(r PublicSharesApiApiGetShareRequest) (**os.File, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue **os.File + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PublicSharesApiService.GetShare") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/shares/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.compress != nil { + localVarQueryParams.Add("compress", parameterToString(*r.compress, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"*/*", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type PublicSharesApiApiGetShareDirContentsRequest struct { + ctx context.Context + ApiService *PublicSharesApiService + id string + path *string +} + +// Path to the folder to read. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root folder is assumed +func (r PublicSharesApiApiGetShareDirContentsRequest) Path(path string) PublicSharesApiApiGetShareDirContentsRequest { + r.path = &path + return r +} + +func (r PublicSharesApiApiGetShareDirContentsRequest) Execute() ([]DirEntry, *http.Response, error) { + return r.ApiService.GetShareDirContentsExecute(r) +} + +/* +GetShareDirContents Read directory contents + +Returns the contents of the specified directory for the specified share. The share must have exactly one path defined and it must be a directory for this to work + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id the share id + @return PublicSharesApiApiGetShareDirContentsRequest +*/ +func (a *PublicSharesApiService) GetShareDirContents(ctx context.Context, id string) PublicSharesApiApiGetShareDirContentsRequest { + return PublicSharesApiApiGetShareDirContentsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return []DirEntry +func (a *PublicSharesApiService) GetShareDirContentsExecute(r PublicSharesApiApiGetShareDirContentsRequest) ([]DirEntry, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []DirEntry + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PublicSharesApiService.GetShareDirContents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/shares/{id}/dirs" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.path != nil { + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type PublicSharesApiApiUploadSingleToShareRequest struct { + ctx context.Context + ApiService *PublicSharesApiService + id string + fileName string + body **os.File + xSFTPGOMTIME *int32 +} + +func (r PublicSharesApiApiUploadSingleToShareRequest) Body(body *os.File) PublicSharesApiApiUploadSingleToShareRequest { + r.body = &body + return r +} +// File modification time as unix timestamp in milliseconds +func (r PublicSharesApiApiUploadSingleToShareRequest) XSFTPGOMTIME(xSFTPGOMTIME int32) PublicSharesApiApiUploadSingleToShareRequest { + r.xSFTPGOMTIME = &xSFTPGOMTIME + return r +} + +func (r PublicSharesApiApiUploadSingleToShareRequest) Execute() ([]ApiResponse, *http.Response, error) { + return r.ApiService.UploadSingleToShareExecute(r) +} + +/* +UploadSingleToShare Upload a single file to the shared path + +The share must be defined with the write scope and the associated user must have the upload/overwrite permissions + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id the share id + @param fileName the name of the new file. It must be path encoded. Sub directories are not accepted + @return PublicSharesApiApiUploadSingleToShareRequest +*/ +func (a *PublicSharesApiService) UploadSingleToShare(ctx context.Context, id string, fileName string) PublicSharesApiApiUploadSingleToShareRequest { + return PublicSharesApiApiUploadSingleToShareRequest{ + ApiService: a, + ctx: ctx, + id: id, + fileName: fileName, + } +} + +// Execute executes the request +// @return []ApiResponse +func (a *PublicSharesApiService) UploadSingleToShareExecute(r PublicSharesApiApiUploadSingleToShareRequest) ([]ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PublicSharesApiService.UploadSingleToShare") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/shares/{id}/{fileName}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fileName"+"}", url.PathEscape(parameterToString(r.fileName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/_*", "text/_*", "image/_*", "audio/_*", "video/_*"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xSFTPGOMTIME != nil { + localVarHeaderParams["X-SFTPGO-MTIME"] = parameterToString(*r.xSFTPGOMTIME, "") + } + // body params + localVarPostBody = r.body + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 413 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type PublicSharesApiApiUploadToShareRequest struct { + ctx context.Context + ApiService *PublicSharesApiService + id string + filenames *[]*os.File +} + +func (r PublicSharesApiApiUploadToShareRequest) Filenames(filenames []*os.File) PublicSharesApiApiUploadToShareRequest { + r.filenames = &filenames + return r +} + +func (r PublicSharesApiApiUploadToShareRequest) Execute() ([]ApiResponse, *http.Response, error) { + return r.ApiService.UploadToShareExecute(r) +} + +/* +UploadToShare Upload one or more files to the shared path + +The share must be defined with the write scope and the associated user must have the upload permission + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id the share id + @return PublicSharesApiApiUploadToShareRequest +*/ +func (a *PublicSharesApiService) UploadToShare(ctx context.Context, id string) PublicSharesApiApiUploadToShareRequest { + return PublicSharesApiApiUploadToShareRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return []ApiResponse +func (a *PublicSharesApiService) UploadToShareExecute(r PublicSharesApiApiUploadToShareRequest) ([]ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PublicSharesApiService.UploadToShare") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/shares/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"multipart/form-data"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + var filenamesLocalVarFormFileName string + var filenamesLocalVarFileName string + var filenamesLocalVarFileBytes []byte + + filenamesLocalVarFormFileName = "filenames" + + var filenamesLocalVarFile []*os.File + if r.filenames != nil { + filenamesLocalVarFile = *r.filenames + } + if filenamesLocalVarFile != nil { + fbs, _ := ioutil.ReadAll(filenamesLocalVarFile[0]) + filenamesLocalVarFileBytes = fbs + filenamesLocalVarFileName = filenamesLocalVarFile[0].Name() + filenamesLocalVarFile[0].Close() + } + formFiles = append(formFiles, formFile{fileBytes: filenamesLocalVarFileBytes, fileName: filenamesLocalVarFileName, formFileName: filenamesLocalVarFormFileName}) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 413 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_quota.go b/server/common/sftpgo/v2/openapi/api_quota.go new file mode 100644 index 00000000..01e4917c --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_quota.go @@ -0,0 +1,2399 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +// QuotaApiService QuotaApi service +type QuotaApiService service + +type QuotaApiApiFolderQuotaUpdateUsageRequest struct { + ctx context.Context + ApiService *QuotaApiService + name string + quotaUsage *QuotaUsage + mode *string +} + +// If used_quota_size and used_quota_files are missing they will default to 0, this means that if mode is \"add\" the current value, for the missing field, will remain unchanged, if mode is \"reset\" the missing field is set to 0 +func (r QuotaApiApiFolderQuotaUpdateUsageRequest) QuotaUsage(quotaUsage QuotaUsage) QuotaApiApiFolderQuotaUpdateUsageRequest { + r.quotaUsage = "aUsage + return r +} +// the update mode specifies if the given quota usage values should be added or replace the current ones +func (r QuotaApiApiFolderQuotaUpdateUsageRequest) Mode(mode string) QuotaApiApiFolderQuotaUpdateUsageRequest { + r.mode = &mode + return r +} + +func (r QuotaApiApiFolderQuotaUpdateUsageRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.FolderQuotaUpdateUsageExecute(r) +} + +/* +FolderQuotaUpdateUsage Update folder quota usage limits + +Sets the current used quota limits for the given folder + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param name folder name + @return QuotaApiApiFolderQuotaUpdateUsageRequest +*/ +func (a *QuotaApiService) FolderQuotaUpdateUsage(ctx context.Context, name string) QuotaApiApiFolderQuotaUpdateUsageRequest { + return QuotaApiApiFolderQuotaUpdateUsageRequest{ + ApiService: a, + ctx: ctx, + name: name, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *QuotaApiService) FolderQuotaUpdateUsageExecute(r QuotaApiApiFolderQuotaUpdateUsageRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.FolderQuotaUpdateUsage") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/quotas/folders/{name}/usage" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(parameterToString(r.name, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.quotaUsage == nil { + return localVarReturnValue, nil, reportError("quotaUsage is required and must be specified") + } + + if r.mode != nil { + localVarQueryParams.Add("mode", parameterToString(*r.mode, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.quotaUsage + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiFolderQuotaUpdateUsageDeprecatedRequest struct { + ctx context.Context + ApiService *QuotaApiService + baseVirtualFolder *BaseVirtualFolder + mode *string +} + +// The only folder mandatory fields are mapped_path,used_quota_size and used_quota_files. Please note that if the used quota fields are missing they will default to 0, this means that if mode is \"add\" the current value will remain unchanged, if mode is \"reset\" the missing field is set to 0 +func (r QuotaApiApiFolderQuotaUpdateUsageDeprecatedRequest) BaseVirtualFolder(baseVirtualFolder BaseVirtualFolder) QuotaApiApiFolderQuotaUpdateUsageDeprecatedRequest { + r.baseVirtualFolder = &baseVirtualFolder + return r +} +// the update mode specifies if the given quota usage values should be added or replace the current ones +func (r QuotaApiApiFolderQuotaUpdateUsageDeprecatedRequest) Mode(mode string) QuotaApiApiFolderQuotaUpdateUsageDeprecatedRequest { + r.mode = &mode + return r +} + +func (r QuotaApiApiFolderQuotaUpdateUsageDeprecatedRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.FolderQuotaUpdateUsageDeprecatedExecute(r) +} + +/* +FolderQuotaUpdateUsageDeprecated Update folder quota limits + +Deprecated, please use '/quotas/folders/{name}/usage' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return QuotaApiApiFolderQuotaUpdateUsageDeprecatedRequest + +Deprecated +*/ +func (a *QuotaApiService) FolderQuotaUpdateUsageDeprecated(ctx context.Context) QuotaApiApiFolderQuotaUpdateUsageDeprecatedRequest { + return QuotaApiApiFolderQuotaUpdateUsageDeprecatedRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +// Deprecated +func (a *QuotaApiService) FolderQuotaUpdateUsageDeprecatedExecute(r QuotaApiApiFolderQuotaUpdateUsageDeprecatedRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.FolderQuotaUpdateUsageDeprecated") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/folder-quota-update" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.baseVirtualFolder == nil { + return localVarReturnValue, nil, reportError("baseVirtualFolder is required and must be specified") + } + + if r.mode != nil { + localVarQueryParams.Add("mode", parameterToString(*r.mode, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.baseVirtualFolder + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiGetFoldersQuotaScansRequest struct { + ctx context.Context + ApiService *QuotaApiService +} + + +func (r QuotaApiApiGetFoldersQuotaScansRequest) Execute() ([]FolderQuotaScan, *http.Response, error) { + return r.ApiService.GetFoldersQuotaScansExecute(r) +} + +/* +GetFoldersQuotaScans Get active folder quota scans + +Returns the active folder quota scans + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return QuotaApiApiGetFoldersQuotaScansRequest +*/ +func (a *QuotaApiService) GetFoldersQuotaScans(ctx context.Context) QuotaApiApiGetFoldersQuotaScansRequest { + return QuotaApiApiGetFoldersQuotaScansRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []FolderQuotaScan +func (a *QuotaApiService) GetFoldersQuotaScansExecute(r QuotaApiApiGetFoldersQuotaScansRequest) ([]FolderQuotaScan, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []FolderQuotaScan + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.GetFoldersQuotaScans") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/quotas/folders/scans" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiGetFoldersQuotaScansDeprecatedRequest struct { + ctx context.Context + ApiService *QuotaApiService +} + + +func (r QuotaApiApiGetFoldersQuotaScansDeprecatedRequest) Execute() ([]FolderQuotaScan, *http.Response, error) { + return r.ApiService.GetFoldersQuotaScansDeprecatedExecute(r) +} + +/* +GetFoldersQuotaScansDeprecated Get folders quota scans + +Deprecated, please use '/quotas/folders/scans' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return QuotaApiApiGetFoldersQuotaScansDeprecatedRequest + +Deprecated +*/ +func (a *QuotaApiService) GetFoldersQuotaScansDeprecated(ctx context.Context) QuotaApiApiGetFoldersQuotaScansDeprecatedRequest { + return QuotaApiApiGetFoldersQuotaScansDeprecatedRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []FolderQuotaScan +// Deprecated +func (a *QuotaApiService) GetFoldersQuotaScansDeprecatedExecute(r QuotaApiApiGetFoldersQuotaScansDeprecatedRequest) ([]FolderQuotaScan, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []FolderQuotaScan + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.GetFoldersQuotaScansDeprecated") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/folder-quota-scans" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiGetUsersQuotaScansRequest struct { + ctx context.Context + ApiService *QuotaApiService +} + + +func (r QuotaApiApiGetUsersQuotaScansRequest) Execute() ([]QuotaScan, *http.Response, error) { + return r.ApiService.GetUsersQuotaScansExecute(r) +} + +/* +GetUsersQuotaScans Get active user quota scans + +Returns the active user quota scans + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return QuotaApiApiGetUsersQuotaScansRequest +*/ +func (a *QuotaApiService) GetUsersQuotaScans(ctx context.Context) QuotaApiApiGetUsersQuotaScansRequest { + return QuotaApiApiGetUsersQuotaScansRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []QuotaScan +func (a *QuotaApiService) GetUsersQuotaScansExecute(r QuotaApiApiGetUsersQuotaScansRequest) ([]QuotaScan, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []QuotaScan + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.GetUsersQuotaScans") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/quotas/users/scans" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiGetUsersQuotaScansDeprecatedRequest struct { + ctx context.Context + ApiService *QuotaApiService +} + + +func (r QuotaApiApiGetUsersQuotaScansDeprecatedRequest) Execute() ([]QuotaScan, *http.Response, error) { + return r.ApiService.GetUsersQuotaScansDeprecatedExecute(r) +} + +/* +GetUsersQuotaScansDeprecated Get quota scans + +Deprecated, please use '/quotas/users/scans' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return QuotaApiApiGetUsersQuotaScansDeprecatedRequest + +Deprecated +*/ +func (a *QuotaApiService) GetUsersQuotaScansDeprecated(ctx context.Context) QuotaApiApiGetUsersQuotaScansDeprecatedRequest { + return QuotaApiApiGetUsersQuotaScansDeprecatedRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []QuotaScan +// Deprecated +func (a *QuotaApiService) GetUsersQuotaScansDeprecatedExecute(r QuotaApiApiGetUsersQuotaScansDeprecatedRequest) ([]QuotaScan, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []QuotaScan + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.GetUsersQuotaScansDeprecated") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/quota-scans" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiStartFolderQuotaScanRequest struct { + ctx context.Context + ApiService *QuotaApiService + name string +} + + +func (r QuotaApiApiStartFolderQuotaScanRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.StartFolderQuotaScanExecute(r) +} + +/* +StartFolderQuotaScan Start a folder quota scan + +Starts a new quota scan for the given folder. A quota scan update the number of files and their total size for the specified folder + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param name folder name + @return QuotaApiApiStartFolderQuotaScanRequest +*/ +func (a *QuotaApiService) StartFolderQuotaScan(ctx context.Context, name string) QuotaApiApiStartFolderQuotaScanRequest { + return QuotaApiApiStartFolderQuotaScanRequest{ + ApiService: a, + ctx: ctx, + name: name, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *QuotaApiService) StartFolderQuotaScanExecute(r QuotaApiApiStartFolderQuotaScanRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.StartFolderQuotaScan") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/quotas/folders/{name}/scan" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(parameterToString(r.name, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiStartFolderQuotaScanDeprecatedRequest struct { + ctx context.Context + ApiService *QuotaApiService + baseVirtualFolder *BaseVirtualFolder +} + +func (r QuotaApiApiStartFolderQuotaScanDeprecatedRequest) BaseVirtualFolder(baseVirtualFolder BaseVirtualFolder) QuotaApiApiStartFolderQuotaScanDeprecatedRequest { + r.baseVirtualFolder = &baseVirtualFolder + return r +} + +func (r QuotaApiApiStartFolderQuotaScanDeprecatedRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.StartFolderQuotaScanDeprecatedExecute(r) +} + +/* +StartFolderQuotaScanDeprecated Start a folder quota scan + +Deprecated, please use '/quotas/folders/{name}/scan' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return QuotaApiApiStartFolderQuotaScanDeprecatedRequest + +Deprecated +*/ +func (a *QuotaApiService) StartFolderQuotaScanDeprecated(ctx context.Context) QuotaApiApiStartFolderQuotaScanDeprecatedRequest { + return QuotaApiApiStartFolderQuotaScanDeprecatedRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +// Deprecated +func (a *QuotaApiService) StartFolderQuotaScanDeprecatedExecute(r QuotaApiApiStartFolderQuotaScanDeprecatedRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.StartFolderQuotaScanDeprecated") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/folder-quota-scans" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.baseVirtualFolder == nil { + return localVarReturnValue, nil, reportError("baseVirtualFolder is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.baseVirtualFolder + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiStartUserQuotaScanRequest struct { + ctx context.Context + ApiService *QuotaApiService + username string +} + + +func (r QuotaApiApiStartUserQuotaScanRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.StartUserQuotaScanExecute(r) +} + +/* +StartUserQuotaScan Start a user quota scan + +Starts a new quota scan for the given user. A quota scan updates the number of files and their total size for the specified user and the virtual folders, if any, included in his quota + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the username + @return QuotaApiApiStartUserQuotaScanRequest +*/ +func (a *QuotaApiService) StartUserQuotaScan(ctx context.Context, username string) QuotaApiApiStartUserQuotaScanRequest { + return QuotaApiApiStartUserQuotaScanRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *QuotaApiService) StartUserQuotaScanExecute(r QuotaApiApiStartUserQuotaScanRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.StartUserQuotaScan") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/quotas/users/{username}/scan" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiStartUserQuotaScanDeprecatedRequest struct { + ctx context.Context + ApiService *QuotaApiService + user *User +} + +func (r QuotaApiApiStartUserQuotaScanDeprecatedRequest) User(user User) QuotaApiApiStartUserQuotaScanDeprecatedRequest { + r.user = &user + return r +} + +func (r QuotaApiApiStartUserQuotaScanDeprecatedRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.StartUserQuotaScanDeprecatedExecute(r) +} + +/* +StartUserQuotaScanDeprecated Start user quota scan + +Deprecated, please use '/quotas/users/{username}/scan' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return QuotaApiApiStartUserQuotaScanDeprecatedRequest + +Deprecated +*/ +func (a *QuotaApiService) StartUserQuotaScanDeprecated(ctx context.Context) QuotaApiApiStartUserQuotaScanDeprecatedRequest { + return QuotaApiApiStartUserQuotaScanDeprecatedRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +// Deprecated +func (a *QuotaApiService) StartUserQuotaScanDeprecatedExecute(r QuotaApiApiStartUserQuotaScanDeprecatedRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.StartUserQuotaScanDeprecated") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/quota-scans" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.user == nil { + return localVarReturnValue, nil, reportError("user is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.user + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiUserQuotaUpdateUsageRequest struct { + ctx context.Context + ApiService *QuotaApiService + username string + quotaUsage *QuotaUsage + mode *string +} + +// If used_quota_size and used_quota_files are missing they will default to 0, this means that if mode is \"add\" the current value, for the missing field, will remain unchanged, if mode is \"reset\" the missing field is set to 0 +func (r QuotaApiApiUserQuotaUpdateUsageRequest) QuotaUsage(quotaUsage QuotaUsage) QuotaApiApiUserQuotaUpdateUsageRequest { + r.quotaUsage = "aUsage + return r +} +// the update mode specifies if the given quota usage values should be added or replace the current ones +func (r QuotaApiApiUserQuotaUpdateUsageRequest) Mode(mode string) QuotaApiApiUserQuotaUpdateUsageRequest { + r.mode = &mode + return r +} + +func (r QuotaApiApiUserQuotaUpdateUsageRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UserQuotaUpdateUsageExecute(r) +} + +/* +UserQuotaUpdateUsage Update disk quota usage limits + +Sets the current used quota limits for the given user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the username + @return QuotaApiApiUserQuotaUpdateUsageRequest +*/ +func (a *QuotaApiService) UserQuotaUpdateUsage(ctx context.Context, username string) QuotaApiApiUserQuotaUpdateUsageRequest { + return QuotaApiApiUserQuotaUpdateUsageRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *QuotaApiService) UserQuotaUpdateUsageExecute(r QuotaApiApiUserQuotaUpdateUsageRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.UserQuotaUpdateUsage") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/quotas/users/{username}/usage" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.quotaUsage == nil { + return localVarReturnValue, nil, reportError("quotaUsage is required and must be specified") + } + + if r.mode != nil { + localVarQueryParams.Add("mode", parameterToString(*r.mode, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.quotaUsage + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiUserQuotaUpdateUsageDeprecatedRequest struct { + ctx context.Context + ApiService *QuotaApiService + user *User + mode *string +} + +// The only user mandatory fields are username, used_quota_size and used_quota_files. Please note that if the quota fields are missing they will default to 0, this means that if mode is \"add\" the current value will remain unchanged, if mode is \"reset\" the missing field is set to 0 +func (r QuotaApiApiUserQuotaUpdateUsageDeprecatedRequest) User(user User) QuotaApiApiUserQuotaUpdateUsageDeprecatedRequest { + r.user = &user + return r +} +// the update mode specifies if the given quota usage values should be added or replace the current ones +func (r QuotaApiApiUserQuotaUpdateUsageDeprecatedRequest) Mode(mode string) QuotaApiApiUserQuotaUpdateUsageDeprecatedRequest { + r.mode = &mode + return r +} + +func (r QuotaApiApiUserQuotaUpdateUsageDeprecatedRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UserQuotaUpdateUsageDeprecatedExecute(r) +} + +/* +UserQuotaUpdateUsageDeprecated Update quota usage limits + +Deprecated, please use '/quotas/users/{username}/usage' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return QuotaApiApiUserQuotaUpdateUsageDeprecatedRequest + +Deprecated +*/ +func (a *QuotaApiService) UserQuotaUpdateUsageDeprecated(ctx context.Context) QuotaApiApiUserQuotaUpdateUsageDeprecatedRequest { + return QuotaApiApiUserQuotaUpdateUsageDeprecatedRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +// Deprecated +func (a *QuotaApiService) UserQuotaUpdateUsageDeprecatedExecute(r QuotaApiApiUserQuotaUpdateUsageDeprecatedRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.UserQuotaUpdateUsageDeprecated") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/quota-update" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.user == nil { + return localVarReturnValue, nil, reportError("user is required and must be specified") + } + + if r.mode != nil { + localVarQueryParams.Add("mode", parameterToString(*r.mode, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.user + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type QuotaApiApiUserTransferQuotaUpdateUsageRequest struct { + ctx context.Context + ApiService *QuotaApiService + username string + transferQuotaUsage *TransferQuotaUsage + mode *string +} + +// If used_upload_data_transfer and used_download_data_transfer are missing they will default to 0, this means that if mode is \"add\" the current value, for the missing field, will remain unchanged, if mode is \"reset\" the missing field is set to 0 +func (r QuotaApiApiUserTransferQuotaUpdateUsageRequest) TransferQuotaUsage(transferQuotaUsage TransferQuotaUsage) QuotaApiApiUserTransferQuotaUpdateUsageRequest { + r.transferQuotaUsage = &transferQuotaUsage + return r +} +// the update mode specifies if the given quota usage values should be added or replace the current ones +func (r QuotaApiApiUserTransferQuotaUpdateUsageRequest) Mode(mode string) QuotaApiApiUserTransferQuotaUpdateUsageRequest { + r.mode = &mode + return r +} + +func (r QuotaApiApiUserTransferQuotaUpdateUsageRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UserTransferQuotaUpdateUsageExecute(r) +} + +/* +UserTransferQuotaUpdateUsage Update transfer quota usage limits + +Sets the current used transfer quota limits for the given user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the username + @return QuotaApiApiUserTransferQuotaUpdateUsageRequest +*/ +func (a *QuotaApiService) UserTransferQuotaUpdateUsage(ctx context.Context, username string) QuotaApiApiUserTransferQuotaUpdateUsageRequest { + return QuotaApiApiUserTransferQuotaUpdateUsageRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *QuotaApiService) UserTransferQuotaUpdateUsageExecute(r QuotaApiApiUserTransferQuotaUpdateUsageRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QuotaApiService.UserTransferQuotaUpdateUsage") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/quotas/users/{username}/transfer-usage" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.transferQuotaUsage == nil { + return localVarReturnValue, nil, reportError("transferQuotaUsage is required and must be specified") + } + + if r.mode != nil { + localVarQueryParams.Add("mode", parameterToString(*r.mode, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.transferQuotaUsage + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_token.go b/server/common/sftpgo/v2/openapi/api_token.go new file mode 100644 index 00000000..34fab845 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_token.go @@ -0,0 +1,593 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" +) + +// Linger please +var ( + _ context.Context +) + +// TokenApiService TokenApi service +type TokenApiService service + +type TokenApiApiClientLogoutRequest struct { + ctx context.Context + ApiService *TokenApiService +} + + +func (r TokenApiApiClientLogoutRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.ClientLogoutExecute(r) +} + +/* +ClientLogout Invalidate a user access token + +Allows to invalidate a client token before its expiration + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return TokenApiApiClientLogoutRequest +*/ +func (a *TokenApiService) ClientLogout(ctx context.Context) TokenApiApiClientLogoutRequest { + return TokenApiApiClientLogoutRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *TokenApiService) ClientLogoutExecute(r TokenApiApiClientLogoutRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TokenApiService.ClientLogout") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/logout" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type TokenApiApiGetTokenRequest struct { + ctx context.Context + ApiService *TokenApiService + xSFTPGOOTP *string +} + +// If you have 2FA configured for the admin attempting to log in you need to set the authentication code using this header parameter +func (r TokenApiApiGetTokenRequest) XSFTPGOOTP(xSFTPGOOTP string) TokenApiApiGetTokenRequest { + r.xSFTPGOOTP = &xSFTPGOOTP + return r +} + +func (r TokenApiApiGetTokenRequest) Execute() (*Token, *http.Response, error) { + return r.ApiService.GetTokenExecute(r) +} + +/* +GetToken Get a new admin access token + +Returns an access token and its expiration + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return TokenApiApiGetTokenRequest +*/ +func (a *TokenApiService) GetToken(ctx context.Context) TokenApiApiGetTokenRequest { + return TokenApiApiGetTokenRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return Token +func (a *TokenApiService) GetTokenExecute(r TokenApiApiGetTokenRequest) (*Token, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Token + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TokenApiService.GetToken") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/token" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xSFTPGOOTP != nil { + localVarHeaderParams["X-SFTPGO-OTP"] = parameterToString(*r.xSFTPGOOTP, "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type TokenApiApiGetUserTokenRequest struct { + ctx context.Context + ApiService *TokenApiService + xSFTPGOOTP *string +} + +// If you have 2FA configured, for the HTTP protocol, for the user attempting to log in you need to set the authentication code using this header parameter +func (r TokenApiApiGetUserTokenRequest) XSFTPGOOTP(xSFTPGOOTP string) TokenApiApiGetUserTokenRequest { + r.xSFTPGOOTP = &xSFTPGOOTP + return r +} + +func (r TokenApiApiGetUserTokenRequest) Execute() (*Token, *http.Response, error) { + return r.ApiService.GetUserTokenExecute(r) +} + +/* +GetUserToken Get a new user access token + +Returns an access token and its expiration + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return TokenApiApiGetUserTokenRequest +*/ +func (a *TokenApiService) GetUserToken(ctx context.Context) TokenApiApiGetUserTokenRequest { + return TokenApiApiGetUserTokenRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return Token +func (a *TokenApiService) GetUserTokenExecute(r TokenApiApiGetUserTokenRequest) (*Token, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Token + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TokenApiService.GetUserToken") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/token" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xSFTPGOOTP != nil { + localVarHeaderParams["X-SFTPGO-OTP"] = parameterToString(*r.xSFTPGOOTP, "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type TokenApiApiLogoutRequest struct { + ctx context.Context + ApiService *TokenApiService +} + + +func (r TokenApiApiLogoutRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.LogoutExecute(r) +} + +/* +Logout Invalidate an admin access token + +Allows to invalidate an admin token before its expiration + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return TokenApiApiLogoutRequest +*/ +func (a *TokenApiService) Logout(ctx context.Context) TokenApiApiLogoutRequest { + return TokenApiApiLogoutRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *TokenApiService) LogoutExecute(r TokenApiApiLogoutRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TokenApiService.Logout") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/logout" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_user_apis.go b/server/common/sftpgo/v2/openapi/api_user_apis.go new file mode 100644 index 00000000..3d04f273 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_user_apis.go @@ -0,0 +1,4928 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "os" +) + +// Linger please +var ( + _ context.Context +) + +// UserAPIsApiService UserAPIsApi service +type UserAPIsApiService service + +type UserAPIsApiApiAddShareRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + share *Share +} + +func (r UserAPIsApiApiAddShareRequest) Share(share Share) UserAPIsApiApiAddShareRequest { + r.share = &share + return r +} + +func (r UserAPIsApiApiAddShareRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.AddShareExecute(r) +} + +/* +AddShare Add a share + +Adds a new share. The share id will be auto-generated + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiAddShareRequest +*/ +func (a *UserAPIsApiService) AddShare(ctx context.Context) UserAPIsApiApiAddShareRequest { + return UserAPIsApiApiAddShareRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UserAPIsApiService) AddShareExecute(r UserAPIsApiApiAddShareRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.AddShare") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/shares" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.share == nil { + return localVarReturnValue, nil, reportError("share is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.share + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiChangeUserPasswordRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + pwdChange *PwdChange +} + +func (r UserAPIsApiApiChangeUserPasswordRequest) PwdChange(pwdChange PwdChange) UserAPIsApiApiChangeUserPasswordRequest { + r.pwdChange = &pwdChange + return r +} + +func (r UserAPIsApiApiChangeUserPasswordRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.ChangeUserPasswordExecute(r) +} + +/* +ChangeUserPassword Change user password + +Changes the password for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiChangeUserPasswordRequest +*/ +func (a *UserAPIsApiService) ChangeUserPassword(ctx context.Context) UserAPIsApiApiChangeUserPasswordRequest { + return UserAPIsApiApiChangeUserPasswordRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UserAPIsApiService) ChangeUserPasswordExecute(r UserAPIsApiApiChangeUserPasswordRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.ChangeUserPassword") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/changepwd" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.pwdChange == nil { + return localVarReturnValue, nil, reportError("pwdChange is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.pwdChange + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiCreateUserDirRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string + mkdirParents *bool +} + +// Path to the folder to create. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" +func (r UserAPIsApiApiCreateUserDirRequest) Path(path string) UserAPIsApiApiCreateUserDirRequest { + r.path = &path + return r +} +// Create parent directories if they do not exist? +func (r UserAPIsApiApiCreateUserDirRequest) MkdirParents(mkdirParents bool) UserAPIsApiApiCreateUserDirRequest { + r.mkdirParents = &mkdirParents + return r +} + +func (r UserAPIsApiApiCreateUserDirRequest) Execute() ([]ApiResponse, *http.Response, error) { + return r.ApiService.CreateUserDirExecute(r) +} + +/* +CreateUserDir Create a directory + +Create a directory for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiCreateUserDirRequest +*/ +func (a *UserAPIsApiService) CreateUserDir(ctx context.Context) UserAPIsApiApiCreateUserDirRequest { + return UserAPIsApiApiCreateUserDirRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ApiResponse +func (a *UserAPIsApiService) CreateUserDirExecute(r UserAPIsApiApiCreateUserDirRequest) ([]ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.CreateUserDir") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/dirs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, nil, reportError("path is required and must be specified") + } + + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + if r.mkdirParents != nil { + localVarQueryParams.Add("mkdir_parents", parameterToString(*r.mkdirParents, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiCreateUserFileRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string + body **os.File + mkdirParents *bool + xSFTPGOMTIME *int32 +} + +// Full file path. It must be path encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\". The parent directory must exist. If a file with the same name already exists, it will be overwritten +func (r UserAPIsApiApiCreateUserFileRequest) Path(path string) UserAPIsApiApiCreateUserFileRequest { + r.path = &path + return r +} +func (r UserAPIsApiApiCreateUserFileRequest) Body(body *os.File) UserAPIsApiApiCreateUserFileRequest { + r.body = &body + return r +} +// Create parent directories if they do not exist? +func (r UserAPIsApiApiCreateUserFileRequest) MkdirParents(mkdirParents bool) UserAPIsApiApiCreateUserFileRequest { + r.mkdirParents = &mkdirParents + return r +} +// File modification time as unix timestamp in milliseconds +func (r UserAPIsApiApiCreateUserFileRequest) XSFTPGOMTIME(xSFTPGOMTIME int32) UserAPIsApiApiCreateUserFileRequest { + r.xSFTPGOMTIME = &xSFTPGOMTIME + return r +} + +func (r UserAPIsApiApiCreateUserFileRequest) Execute() ([]ApiResponse, *http.Response, error) { + return r.ApiService.CreateUserFileExecute(r) +} + +/* +CreateUserFile Upload a single file + +Upload a single file for the logged in user to an existing directory. This API does not use multipart/form-data and so no temporary files are created server side but only a single file can be uploaded as POST body + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiCreateUserFileRequest +*/ +func (a *UserAPIsApiService) CreateUserFile(ctx context.Context) UserAPIsApiApiCreateUserFileRequest { + return UserAPIsApiApiCreateUserFileRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ApiResponse +func (a *UserAPIsApiService) CreateUserFileExecute(r UserAPIsApiApiCreateUserFileRequest) ([]ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.CreateUserFile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/files/upload" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, nil, reportError("path is required and must be specified") + } + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } + + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + if r.mkdirParents != nil { + localVarQueryParams.Add("mkdir_parents", parameterToString(*r.mkdirParents, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/_*", "text/_*", "image/_*", "audio/_*", "video/_*"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xSFTPGOMTIME != nil { + localVarHeaderParams["X-SFTPGO-MTIME"] = parameterToString(*r.xSFTPGOMTIME, "") + } + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 413 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiCreateUserFilesRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string + mkdirParents *bool + filenames *[]*os.File +} + +// Parent directory for the uploaded files. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root path is assumed. If a file with the same name already exists, it will be overwritten +func (r UserAPIsApiApiCreateUserFilesRequest) Path(path string) UserAPIsApiApiCreateUserFilesRequest { + r.path = &path + return r +} +// Create parent directories if they do not exist? +func (r UserAPIsApiApiCreateUserFilesRequest) MkdirParents(mkdirParents bool) UserAPIsApiApiCreateUserFilesRequest { + r.mkdirParents = &mkdirParents + return r +} +func (r UserAPIsApiApiCreateUserFilesRequest) Filenames(filenames []*os.File) UserAPIsApiApiCreateUserFilesRequest { + r.filenames = &filenames + return r +} + +func (r UserAPIsApiApiCreateUserFilesRequest) Execute() ([]ApiResponse, *http.Response, error) { + return r.ApiService.CreateUserFilesExecute(r) +} + +/* +CreateUserFiles Upload files + +Upload one or more files for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiCreateUserFilesRequest +*/ +func (a *UserAPIsApiService) CreateUserFiles(ctx context.Context) UserAPIsApiApiCreateUserFilesRequest { + return UserAPIsApiApiCreateUserFilesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ApiResponse +func (a *UserAPIsApiService) CreateUserFilesExecute(r UserAPIsApiApiCreateUserFilesRequest) ([]ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.CreateUserFiles") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/files" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.path != nil { + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + } + if r.mkdirParents != nil { + localVarQueryParams.Add("mkdir_parents", parameterToString(*r.mkdirParents, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"multipart/form-data"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + var filenamesLocalVarFormFileName string + var filenamesLocalVarFileName string + var filenamesLocalVarFileBytes []byte + + filenamesLocalVarFormFileName = "filenames" + + var filenamesLocalVarFile []*os.File + if r.filenames != nil { + filenamesLocalVarFile = *r.filenames + } + if filenamesLocalVarFile != nil { + fbs, _ := ioutil.ReadAll(filenamesLocalVarFile[0]) + filenamesLocalVarFileBytes = fbs + filenamesLocalVarFileName = filenamesLocalVarFile[0].Name() + filenamesLocalVarFile[0].Close() + } + formFiles = append(formFiles, formFile{fileBytes: filenamesLocalVarFileBytes, fileName: filenamesLocalVarFileName, formFileName: filenamesLocalVarFormFileName}) + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 413 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiDeleteUserDirRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string +} + +// Path to the folder to delete. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" +func (r UserAPIsApiApiDeleteUserDirRequest) Path(path string) UserAPIsApiApiDeleteUserDirRequest { + r.path = &path + return r +} + +func (r UserAPIsApiApiDeleteUserDirRequest) Execute() ([]ApiResponse, *http.Response, error) { + return r.ApiService.DeleteUserDirExecute(r) +} + +/* +DeleteUserDir Delete a directory + +Delete a directory for the logged in user. Only empty directories can be deleted + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiDeleteUserDirRequest +*/ +func (a *UserAPIsApiService) DeleteUserDir(ctx context.Context) UserAPIsApiApiDeleteUserDirRequest { + return UserAPIsApiApiDeleteUserDirRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ApiResponse +func (a *UserAPIsApiService) DeleteUserDirExecute(r UserAPIsApiApiDeleteUserDirRequest) ([]ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.DeleteUserDir") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/dirs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, nil, reportError("path is required and must be specified") + } + + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiDeleteUserFileRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string +} + +// Path to the file to delete. It must be URL encoded +func (r UserAPIsApiApiDeleteUserFileRequest) Path(path string) UserAPIsApiApiDeleteUserFileRequest { + r.path = &path + return r +} + +func (r UserAPIsApiApiDeleteUserFileRequest) Execute() ([]ApiResponse, *http.Response, error) { + return r.ApiService.DeleteUserFileExecute(r) +} + +/* +DeleteUserFile Delete a file + +Delete a file for the logged in user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiDeleteUserFileRequest +*/ +func (a *UserAPIsApiService) DeleteUserFile(ctx context.Context) UserAPIsApiApiDeleteUserFileRequest { + return UserAPIsApiApiDeleteUserFileRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ApiResponse +func (a *UserAPIsApiService) DeleteUserFileExecute(r UserAPIsApiApiDeleteUserFileRequest) ([]ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.DeleteUserFile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/files" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, nil, reportError("path is required and must be specified") + } + + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiDeleteUserShareRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + id string +} + + +func (r UserAPIsApiApiDeleteUserShareRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.DeleteUserShareExecute(r) +} + +/* +DeleteUserShare Delete share + +Deletes an existing share belonging to the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id the share id + @return UserAPIsApiApiDeleteUserShareRequest +*/ +func (a *UserAPIsApiService) DeleteUserShare(ctx context.Context, id string) UserAPIsApiApiDeleteUserShareRequest { + return UserAPIsApiApiDeleteUserShareRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UserAPIsApiService) DeleteUserShareExecute(r UserAPIsApiApiDeleteUserShareRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.DeleteUserShare") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/shares/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiDownloadUserFileRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string + inline *string +} + +// Path to the file to download. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" +func (r UserAPIsApiApiDownloadUserFileRequest) Path(path string) UserAPIsApiApiDownloadUserFileRequest { + r.path = &path + return r +} +// If set, the response will not have the Content-Disposition header set to `attachment` +func (r UserAPIsApiApiDownloadUserFileRequest) Inline(inline string) UserAPIsApiApiDownloadUserFileRequest { + r.inline = &inline + return r +} + +func (r UserAPIsApiApiDownloadUserFileRequest) Execute() (**os.File, *http.Response, error) { + return r.ApiService.DownloadUserFileExecute(r) +} + +/* +DownloadUserFile Download a single file + +Returns the file contents as response body + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiDownloadUserFileRequest +*/ +func (a *UserAPIsApiService) DownloadUserFile(ctx context.Context) UserAPIsApiApiDownloadUserFileRequest { + return UserAPIsApiApiDownloadUserFileRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return *os.File +func (a *UserAPIsApiService) DownloadUserFileExecute(r UserAPIsApiApiDownloadUserFileRequest) (**os.File, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue **os.File + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.DownloadUserFile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/files" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, nil, reportError("path is required and must be specified") + } + + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + if r.inline != nil { + localVarQueryParams.Add("inline", parameterToString(*r.inline, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"*/*", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiGenerateUserRecoveryCodesRequest struct { + ctx context.Context + ApiService *UserAPIsApiService +} + + +func (r UserAPIsApiApiGenerateUserRecoveryCodesRequest) Execute() ([]string, *http.Response, error) { + return r.ApiService.GenerateUserRecoveryCodesExecute(r) +} + +/* +GenerateUserRecoveryCodes Generate recovery codes + +Generates new recovery codes for the logged in user. Generating new recovery codes you automatically invalidate old ones + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiGenerateUserRecoveryCodesRequest +*/ +func (a *UserAPIsApiService) GenerateUserRecoveryCodes(ctx context.Context) UserAPIsApiApiGenerateUserRecoveryCodesRequest { + return UserAPIsApiApiGenerateUserRecoveryCodesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []string +func (a *UserAPIsApiService) GenerateUserRecoveryCodesExecute(r UserAPIsApiApiGenerateUserRecoveryCodesRequest) ([]string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.GenerateUserRecoveryCodes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/2fa/recoverycodes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiGenerateUserTotpSecretRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + inlineObject6 *InlineObject6 +} + +func (r UserAPIsApiApiGenerateUserTotpSecretRequest) InlineObject6(inlineObject6 InlineObject6) UserAPIsApiApiGenerateUserTotpSecretRequest { + r.inlineObject6 = &inlineObject6 + return r +} + +func (r UserAPIsApiApiGenerateUserTotpSecretRequest) Execute() (*InlineResponse200, *http.Response, error) { + return r.ApiService.GenerateUserTotpSecretExecute(r) +} + +/* +GenerateUserTotpSecret Generate a new TOTP secret + +Generates a new TOTP secret, including the QR code as png, using the specified configuration for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiGenerateUserTotpSecretRequest +*/ +func (a *UserAPIsApiService) GenerateUserTotpSecret(ctx context.Context) UserAPIsApiApiGenerateUserTotpSecretRequest { + return UserAPIsApiApiGenerateUserTotpSecretRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return InlineResponse200 +func (a *UserAPIsApiService) GenerateUserTotpSecretExecute(r UserAPIsApiApiGenerateUserTotpSecretRequest) (*InlineResponse200, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InlineResponse200 + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.GenerateUserTotpSecret") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/totp/generate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inlineObject6 == nil { + return localVarReturnValue, nil, reportError("inlineObject6 is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inlineObject6 + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiGetUserDirContentsRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string +} + +// Path to the folder to read. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root folder is assumed +func (r UserAPIsApiApiGetUserDirContentsRequest) Path(path string) UserAPIsApiApiGetUserDirContentsRequest { + r.path = &path + return r +} + +func (r UserAPIsApiApiGetUserDirContentsRequest) Execute() ([]DirEntry, *http.Response, error) { + return r.ApiService.GetUserDirContentsExecute(r) +} + +/* +GetUserDirContents Read directory contents + +Returns the contents of the specified directory for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiGetUserDirContentsRequest +*/ +func (a *UserAPIsApiService) GetUserDirContents(ctx context.Context) UserAPIsApiApiGetUserDirContentsRequest { + return UserAPIsApiApiGetUserDirContentsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []DirEntry +func (a *UserAPIsApiService) GetUserDirContentsExecute(r UserAPIsApiApiGetUserDirContentsRequest) ([]DirEntry, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []DirEntry + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.GetUserDirContents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/dirs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.path != nil { + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiGetUserFileRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string +} + +// Path to the file to download. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" +func (r UserAPIsApiApiGetUserFileRequest) Path(path string) UserAPIsApiApiGetUserFileRequest { + r.path = &path + return r +} + +func (r UserAPIsApiApiGetUserFileRequest) Execute() (**os.File, *http.Response, error) { + return r.ApiService.GetUserFileExecute(r) +} + +/* +GetUserFile Download a single file + +Returns the file contents as response body. Please use '/user/files' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiGetUserFileRequest + +Deprecated +*/ +func (a *UserAPIsApiService) GetUserFile(ctx context.Context) UserAPIsApiApiGetUserFileRequest { + return UserAPIsApiApiGetUserFileRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return *os.File +// Deprecated +func (a *UserAPIsApiService) GetUserFileExecute(r UserAPIsApiApiGetUserFileRequest) (**os.File, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue **os.File + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.GetUserFile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/file" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, nil, reportError("path is required and must be specified") + } + + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"*/*", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiGetUserFolderContentsRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string +} + +// Path to the folder to read. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root folder is assumed +func (r UserAPIsApiApiGetUserFolderContentsRequest) Path(path string) UserAPIsApiApiGetUserFolderContentsRequest { + r.path = &path + return r +} + +func (r UserAPIsApiApiGetUserFolderContentsRequest) Execute() ([]DirEntry, *http.Response, error) { + return r.ApiService.GetUserFolderContentsExecute(r) +} + +/* +GetUserFolderContents Read folders contents + +Returns the contents of the specified folder for the logged in user. Please use '/user/dirs' instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiGetUserFolderContentsRequest + +Deprecated +*/ +func (a *UserAPIsApiService) GetUserFolderContents(ctx context.Context) UserAPIsApiApiGetUserFolderContentsRequest { + return UserAPIsApiApiGetUserFolderContentsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []DirEntry +// Deprecated +func (a *UserAPIsApiService) GetUserFolderContentsExecute(r UserAPIsApiApiGetUserFolderContentsRequest) ([]DirEntry, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []DirEntry + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.GetUserFolderContents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/folder" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.path != nil { + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiGetUserProfileRequest struct { + ctx context.Context + ApiService *UserAPIsApiService +} + + +func (r UserAPIsApiApiGetUserProfileRequest) Execute() (*UserProfile, *http.Response, error) { + return r.ApiService.GetUserProfileExecute(r) +} + +/* +GetUserProfile Get user profile + +Returns the profile for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiGetUserProfileRequest +*/ +func (a *UserAPIsApiService) GetUserProfile(ctx context.Context) UserAPIsApiApiGetUserProfileRequest { + return UserAPIsApiApiGetUserProfileRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return UserProfile +func (a *UserAPIsApiService) GetUserProfileExecute(r UserAPIsApiApiGetUserProfileRequest) (*UserProfile, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UserProfile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.GetUserProfile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/profile" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiGetUserPublicKeysRequest struct { + ctx context.Context + ApiService *UserAPIsApiService +} + + +func (r UserAPIsApiApiGetUserPublicKeysRequest) Execute() ([]string, *http.Response, error) { + return r.ApiService.GetUserPublicKeysExecute(r) +} + +/* +GetUserPublicKeys Get the user's public keys + +Returns the public keys for the logged in user. Deprecated please use "/user/profile" instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiGetUserPublicKeysRequest + +Deprecated +*/ +func (a *UserAPIsApiService) GetUserPublicKeys(ctx context.Context) UserAPIsApiApiGetUserPublicKeysRequest { + return UserAPIsApiApiGetUserPublicKeysRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []string +// Deprecated +func (a *UserAPIsApiService) GetUserPublicKeysExecute(r UserAPIsApiApiGetUserPublicKeysRequest) ([]string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.GetUserPublicKeys") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/publickeys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiGetUserRecoveryCodesRequest struct { + ctx context.Context + ApiService *UserAPIsApiService +} + + +func (r UserAPIsApiApiGetUserRecoveryCodesRequest) Execute() ([]RecoveryCode, *http.Response, error) { + return r.ApiService.GetUserRecoveryCodesExecute(r) +} + +/* +GetUserRecoveryCodes Get recovery codes + +Returns the recovery codes for the logged in user. Recovery codes can be used if the user loses access to their second factor auth device. Recovery codes are returned unencrypted + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiGetUserRecoveryCodesRequest +*/ +func (a *UserAPIsApiService) GetUserRecoveryCodes(ctx context.Context) UserAPIsApiApiGetUserRecoveryCodesRequest { + return UserAPIsApiApiGetUserRecoveryCodesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []RecoveryCode +func (a *UserAPIsApiService) GetUserRecoveryCodesExecute(r UserAPIsApiApiGetUserRecoveryCodesRequest) ([]RecoveryCode, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []RecoveryCode + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.GetUserRecoveryCodes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/2fa/recoverycodes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiGetUserShareByIdRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + id string +} + + +func (r UserAPIsApiApiGetUserShareByIdRequest) Execute() (*Share, *http.Response, error) { + return r.ApiService.GetUserShareByIdExecute(r) +} + +/* +GetUserShareById Get share by id + +Returns a share by id for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id the share id + @return UserAPIsApiApiGetUserShareByIdRequest +*/ +func (a *UserAPIsApiService) GetUserShareById(ctx context.Context, id string) UserAPIsApiApiGetUserShareByIdRequest { + return UserAPIsApiApiGetUserShareByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return Share +func (a *UserAPIsApiService) GetUserShareByIdExecute(r UserAPIsApiApiGetUserShareByIdRequest) (*Share, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Share + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.GetUserShareById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/shares/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiGetUserSharesRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + offset *int32 + limit *int32 + order *string +} + +func (r UserAPIsApiApiGetUserSharesRequest) Offset(offset int32) UserAPIsApiApiGetUserSharesRequest { + r.offset = &offset + return r +} +// The maximum number of items to return. Max value is 500, default is 100 +func (r UserAPIsApiApiGetUserSharesRequest) Limit(limit int32) UserAPIsApiApiGetUserSharesRequest { + r.limit = &limit + return r +} +// Ordering shares by ID. Default ASC +func (r UserAPIsApiApiGetUserSharesRequest) Order(order string) UserAPIsApiApiGetUserSharesRequest { + r.order = &order + return r +} + +func (r UserAPIsApiApiGetUserSharesRequest) Execute() ([]Share, *http.Response, error) { + return r.ApiService.GetUserSharesExecute(r) +} + +/* +GetUserShares List user shares + +Returns the share for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiGetUserSharesRequest +*/ +func (a *UserAPIsApiService) GetUserShares(ctx context.Context) UserAPIsApiApiGetUserSharesRequest { + return UserAPIsApiApiGetUserSharesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []Share +func (a *UserAPIsApiService) GetUserSharesExecute(r UserAPIsApiApiGetUserSharesRequest) ([]Share, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Share + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.GetUserShares") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/shares" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.offset != nil { + localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) + } + if r.order != nil { + localVarQueryParams.Add("order", parameterToString(*r.order, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiGetUserTotpConfigsRequest struct { + ctx context.Context + ApiService *UserAPIsApiService +} + + +func (r UserAPIsApiApiGetUserTotpConfigsRequest) Execute() ([]TOTPConfig, *http.Response, error) { + return r.ApiService.GetUserTotpConfigsExecute(r) +} + +/* +GetUserTotpConfigs Get available TOTP configuration + +Returns the available TOTP configurations for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiGetUserTotpConfigsRequest +*/ +func (a *UserAPIsApiService) GetUserTotpConfigs(ctx context.Context) UserAPIsApiApiGetUserTotpConfigsRequest { + return UserAPIsApiApiGetUserTotpConfigsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []TOTPConfig +func (a *UserAPIsApiService) GetUserTotpConfigsExecute(r UserAPIsApiApiGetUserTotpConfigsRequest) ([]TOTPConfig, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []TOTPConfig + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.GetUserTotpConfigs") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/totp/configs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiRenameUserDirRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string + target *string +} + +// Path to the folder to rename. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" +func (r UserAPIsApiApiRenameUserDirRequest) Path(path string) UserAPIsApiApiRenameUserDirRequest { + r.path = &path + return r +} +// New name. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" +func (r UserAPIsApiApiRenameUserDirRequest) Target(target string) UserAPIsApiApiRenameUserDirRequest { + r.target = &target + return r +} + +func (r UserAPIsApiApiRenameUserDirRequest) Execute() ([]ApiResponse, *http.Response, error) { + return r.ApiService.RenameUserDirExecute(r) +} + +/* +RenameUserDir Rename a directory + +Rename a directory for the logged in user. The rename is allowed for empty directory or for non empty local directories, with no virtual folders inside + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiRenameUserDirRequest +*/ +func (a *UserAPIsApiService) RenameUserDir(ctx context.Context) UserAPIsApiApiRenameUserDirRequest { + return UserAPIsApiApiRenameUserDirRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ApiResponse +func (a *UserAPIsApiService) RenameUserDirExecute(r UserAPIsApiApiRenameUserDirRequest) ([]ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.RenameUserDir") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/dirs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, nil, reportError("path is required and must be specified") + } + if r.target == nil { + return localVarReturnValue, nil, reportError("target is required and must be specified") + } + + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + localVarQueryParams.Add("target", parameterToString(*r.target, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiRenameUserFileRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string + target *string +} + +// Path to the file to rename. It must be URL encoded +func (r UserAPIsApiApiRenameUserFileRequest) Path(path string) UserAPIsApiApiRenameUserFileRequest { + r.path = &path + return r +} +// New name. It must be URL encoded +func (r UserAPIsApiApiRenameUserFileRequest) Target(target string) UserAPIsApiApiRenameUserFileRequest { + r.target = &target + return r +} + +func (r UserAPIsApiApiRenameUserFileRequest) Execute() ([]ApiResponse, *http.Response, error) { + return r.ApiService.RenameUserFileExecute(r) +} + +/* +RenameUserFile Rename a file + +Rename a file for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiRenameUserFileRequest +*/ +func (a *UserAPIsApiService) RenameUserFile(ctx context.Context) UserAPIsApiApiRenameUserFileRequest { + return UserAPIsApiApiRenameUserFileRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ApiResponse +func (a *UserAPIsApiService) RenameUserFileExecute(r UserAPIsApiApiRenameUserFileRequest) ([]ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.RenameUserFile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/files" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, nil, reportError("path is required and must be specified") + } + if r.target == nil { + return localVarReturnValue, nil, reportError("target is required and must be specified") + } + + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + localVarQueryParams.Add("target", parameterToString(*r.target, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiSaveUserTotpConfigRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + userTOTPConfig *UserTOTPConfig +} + +func (r UserAPIsApiApiSaveUserTotpConfigRequest) UserTOTPConfig(userTOTPConfig UserTOTPConfig) UserAPIsApiApiSaveUserTotpConfigRequest { + r.userTOTPConfig = &userTOTPConfig + return r +} + +func (r UserAPIsApiApiSaveUserTotpConfigRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.SaveUserTotpConfigExecute(r) +} + +/* +SaveUserTotpConfig Save a TOTP config + +Saves the specified TOTP config for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiSaveUserTotpConfigRequest +*/ +func (a *UserAPIsApiService) SaveUserTotpConfig(ctx context.Context) UserAPIsApiApiSaveUserTotpConfigRequest { + return UserAPIsApiApiSaveUserTotpConfigRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UserAPIsApiService) SaveUserTotpConfigExecute(r UserAPIsApiApiSaveUserTotpConfigRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.SaveUserTotpConfig") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/totp/save" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.userTOTPConfig == nil { + return localVarReturnValue, nil, reportError("userTOTPConfig is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.userTOTPConfig + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiSetUserPublicKeysRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + requestBody *[]string +} + +func (r UserAPIsApiApiSetUserPublicKeysRequest) RequestBody(requestBody []string) UserAPIsApiApiSetUserPublicKeysRequest { + r.requestBody = &requestBody + return r +} + +func (r UserAPIsApiApiSetUserPublicKeysRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.SetUserPublicKeysExecute(r) +} + +/* +SetUserPublicKeys Set the user's public keys + +Sets the public keys for the logged in user. Public keys must be in OpenSSH format. Deprecated please use "/user/profile" instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiSetUserPublicKeysRequest + +Deprecated +*/ +func (a *UserAPIsApiService) SetUserPublicKeys(ctx context.Context) UserAPIsApiApiSetUserPublicKeysRequest { + return UserAPIsApiApiSetUserPublicKeysRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +// Deprecated +func (a *UserAPIsApiService) SetUserPublicKeysExecute(r UserAPIsApiApiSetUserPublicKeysRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.SetUserPublicKeys") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/publickeys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.requestBody == nil { + return localVarReturnValue, nil, reportError("requestBody is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.requestBody + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiSetpropsUserFileRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + path *string + inlineObject9 *InlineObject9 +} + +// Full file/directory path. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" +func (r UserAPIsApiApiSetpropsUserFileRequest) Path(path string) UserAPIsApiApiSetpropsUserFileRequest { + r.path = &path + return r +} +func (r UserAPIsApiApiSetpropsUserFileRequest) InlineObject9(inlineObject9 InlineObject9) UserAPIsApiApiSetpropsUserFileRequest { + r.inlineObject9 = &inlineObject9 + return r +} + +func (r UserAPIsApiApiSetpropsUserFileRequest) Execute() ([]ApiResponse, *http.Response, error) { + return r.ApiService.SetpropsUserFileExecute(r) +} + +/* +SetpropsUserFile Set metadata for a file/directory + +Set supported metadata attributes for the specified file or directory + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiSetpropsUserFileRequest +*/ +func (a *UserAPIsApiService) SetpropsUserFile(ctx context.Context) UserAPIsApiApiSetpropsUserFileRequest { + return UserAPIsApiApiSetpropsUserFileRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ApiResponse +func (a *UserAPIsApiService) SetpropsUserFileExecute(r UserAPIsApiApiSetpropsUserFileRequest) ([]ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.SetpropsUserFile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/files/metadata" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, nil, reportError("path is required and must be specified") + } + if r.inlineObject9 == nil { + return localVarReturnValue, nil, reportError("inlineObject9 is required and must be specified") + } + + localVarQueryParams.Add("path", parameterToString(*r.path, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inlineObject9 + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 413 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiStreamzipRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + requestBody *[]string +} + +func (r UserAPIsApiApiStreamzipRequest) RequestBody(requestBody []string) UserAPIsApiApiStreamzipRequest { + r.requestBody = &requestBody + return r +} + +func (r UserAPIsApiApiStreamzipRequest) Execute() (**os.File, *http.Response, error) { + return r.ApiService.StreamzipExecute(r) +} + +/* +Streamzip Download multiple files and folders as a single zip file + +A zip file, containing the specified files and folders, will be generated on the fly and returned as response body. Only folders and regular files will be included in the zip + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiStreamzipRequest +*/ +func (a *UserAPIsApiService) Streamzip(ctx context.Context) UserAPIsApiApiStreamzipRequest { + return UserAPIsApiApiStreamzipRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return *os.File +func (a *UserAPIsApiService) StreamzipExecute(r UserAPIsApiApiStreamzipRequest) (**os.File, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue **os.File + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.Streamzip") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/streamzip" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.requestBody == nil { + return localVarReturnValue, nil, reportError("requestBody is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/zip", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.requestBody + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiUpdateUserProfileRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + userProfile *UserProfile +} + +func (r UserAPIsApiApiUpdateUserProfileRequest) UserProfile(userProfile UserProfile) UserAPIsApiApiUpdateUserProfileRequest { + r.userProfile = &userProfile + return r +} + +func (r UserAPIsApiApiUpdateUserProfileRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UpdateUserProfileExecute(r) +} + +/* +UpdateUserProfile Update user profile + +Allows to update the profile for the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiUpdateUserProfileRequest +*/ +func (a *UserAPIsApiService) UpdateUserProfile(ctx context.Context) UserAPIsApiApiUpdateUserProfileRequest { + return UserAPIsApiApiUpdateUserProfileRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UserAPIsApiService) UpdateUserProfileExecute(r UserAPIsApiApiUpdateUserProfileRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.UpdateUserProfile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/profile" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.userProfile == nil { + return localVarReturnValue, nil, reportError("userProfile is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.userProfile + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiUpdateUserShareRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + id string + share *Share +} + +func (r UserAPIsApiApiUpdateUserShareRequest) Share(share Share) UserAPIsApiApiUpdateUserShareRequest { + r.share = &share + return r +} + +func (r UserAPIsApiApiUpdateUserShareRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UpdateUserShareExecute(r) +} + +/* +UpdateUserShare Update share + +Updates an existing share belonging to the logged in user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id the share id + @return UserAPIsApiApiUpdateUserShareRequest +*/ +func (a *UserAPIsApiService) UpdateUserShare(ctx context.Context, id string) UserAPIsApiApiUpdateUserShareRequest { + return UserAPIsApiApiUpdateUserShareRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UserAPIsApiService) UpdateUserShareExecute(r UserAPIsApiApiUpdateUserShareRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.UpdateUserShare") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/shares/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.share == nil { + return localVarReturnValue, nil, reportError("share is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.share + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UserAPIsApiApiValidateUserTotpSecretRequest struct { + ctx context.Context + ApiService *UserAPIsApiService + inlineObject7 *InlineObject7 +} + +func (r UserAPIsApiApiValidateUserTotpSecretRequest) InlineObject7(inlineObject7 InlineObject7) UserAPIsApiApiValidateUserTotpSecretRequest { + r.inlineObject7 = &inlineObject7 + return r +} + +func (r UserAPIsApiApiValidateUserTotpSecretRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.ValidateUserTotpSecretExecute(r) +} + +/* +ValidateUserTotpSecret Validate a one time authentication code + +Checks if the given authentication code can be validated using the specified secret and config name + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UserAPIsApiApiValidateUserTotpSecretRequest +*/ +func (a *UserAPIsApiService) ValidateUserTotpSecret(ctx context.Context) UserAPIsApiApiValidateUserTotpSecretRequest { + return UserAPIsApiApiValidateUserTotpSecretRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UserAPIsApiService) ValidateUserTotpSecretExecute(r UserAPIsApiApiValidateUserTotpSecretRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIsApiService.ValidateUserTotpSecret") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/totp/validate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inlineObject7 == nil { + return localVarReturnValue, nil, reportError("inlineObject7 is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inlineObject7 + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/api_users.go b/server/common/sftpgo/v2/openapi/api_users.go new file mode 100644 index 00000000..84ec1808 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/api_users.go @@ -0,0 +1,1437 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +// UsersApiService UsersApi service +type UsersApiService service + +type UsersApiApiAddUserRequest struct { + ctx context.Context + ApiService *UsersApiService + user *User +} + +func (r UsersApiApiAddUserRequest) User(user User) UsersApiApiAddUserRequest { + r.user = &user + return r +} + +func (r UsersApiApiAddUserRequest) Execute() (*User, *http.Response, error) { + return r.ApiService.AddUserExecute(r) +} + +/* +AddUser Add user + +Adds a new user.Recovery codes and TOTP configuration cannot be set using this API: each user must use the specific APIs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UsersApiApiAddUserRequest +*/ +func (a *UsersApiService) AddUser(ctx context.Context) UsersApiApiAddUserRequest { + return UsersApiApiAddUserRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return User +func (a *UsersApiService) AddUserExecute(r UsersApiApiAddUserRequest) (*User, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.AddUser") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.user == nil { + return localVarReturnValue, nil, reportError("user is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.user + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UsersApiApiDeleteUserRequest struct { + ctx context.Context + ApiService *UsersApiService + username string +} + + +func (r UsersApiApiDeleteUserRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.DeleteUserExecute(r) +} + +/* +DeleteUser Delete user + +Deletes an existing user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the username + @return UsersApiApiDeleteUserRequest +*/ +func (a *UsersApiService) DeleteUser(ctx context.Context, username string) UsersApiApiDeleteUserRequest { + return UsersApiApiDeleteUserRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UsersApiService) DeleteUserExecute(r UsersApiApiDeleteUserRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.DeleteUser") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UsersApiApiDisableUser2faRequest struct { + ctx context.Context + ApiService *UsersApiService + username string +} + + +func (r UsersApiApiDisableUser2faRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.DisableUser2faExecute(r) +} + +/* +DisableUser2fa Disable second factor authentication + +Disables second factor authentication for the given user. This API must be used if the user loses access to their second factor auth device and has no recovery codes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the username + @return UsersApiApiDisableUser2faRequest +*/ +func (a *UsersApiService) DisableUser2fa(ctx context.Context, username string) UsersApiApiDisableUser2faRequest { + return UsersApiApiDisableUser2faRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UsersApiService) DisableUser2faExecute(r UsersApiApiDisableUser2faRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.DisableUser2fa") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{username}/2fa/disable" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UsersApiApiGetUserByUsernameRequest struct { + ctx context.Context + ApiService *UsersApiService + username string +} + + +func (r UsersApiApiGetUserByUsernameRequest) Execute() (*User, *http.Response, error) { + return r.ApiService.GetUserByUsernameExecute(r) +} + +/* +GetUserByUsername Find users by username + +Returns the user with the given username if it exists. For security reasons the hashed password is omitted in the response + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the username + @return UsersApiApiGetUserByUsernameRequest +*/ +func (a *UsersApiService) GetUserByUsername(ctx context.Context, username string) UsersApiApiGetUserByUsernameRequest { + return UsersApiApiGetUserByUsernameRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return User +func (a *UsersApiService) GetUserByUsernameExecute(r UsersApiApiGetUserByUsernameRequest) (*User, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.GetUserByUsername") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UsersApiApiGetUsersRequest struct { + ctx context.Context + ApiService *UsersApiService + offset *int32 + limit *int32 + order *string +} + +func (r UsersApiApiGetUsersRequest) Offset(offset int32) UsersApiApiGetUsersRequest { + r.offset = &offset + return r +} +// The maximum number of items to return. Max value is 500, default is 100 +func (r UsersApiApiGetUsersRequest) Limit(limit int32) UsersApiApiGetUsersRequest { + r.limit = &limit + return r +} +// Ordering users by username. Default ASC +func (r UsersApiApiGetUsersRequest) Order(order string) UsersApiApiGetUsersRequest { + r.order = &order + return r +} + +func (r UsersApiApiGetUsersRequest) Execute() ([]User, *http.Response, error) { + return r.ApiService.GetUsersExecute(r) +} + +/* +GetUsers Get users + +Returns an array with one or more users. For security reasons hashed passwords are omitted in the response + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return UsersApiApiGetUsersRequest +*/ +func (a *UsersApiService) GetUsers(ctx context.Context) UsersApiApiGetUsersRequest { + return UsersApiApiGetUsersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []User +func (a *UsersApiService) GetUsersExecute(r UsersApiApiGetUsersRequest) ([]User, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.GetUsers") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.offset != nil { + localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) + } + if r.order != nil { + localVarQueryParams.Add("order", parameterToString(*r.order, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UsersApiApiUpdateUserRequest struct { + ctx context.Context + ApiService *UsersApiService + username string + user *User + disconnect *int32 +} + +func (r UsersApiApiUpdateUserRequest) User(user User) UsersApiApiUpdateUserRequest { + r.user = &user + return r +} +// Disconnect: * `0` The user will not be disconnected and it will continue to use the old configuration until connected. This is the default * `1` The user will be disconnected after a successful update. It must login again and so it will be forced to use the new configuration +func (r UsersApiApiUpdateUserRequest) Disconnect(disconnect int32) UsersApiApiUpdateUserRequest { + r.disconnect = &disconnect + return r +} + +func (r UsersApiApiUpdateUserRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UpdateUserExecute(r) +} + +/* +UpdateUser Update user + +Updates an existing user and optionally disconnects it, if connected, to apply the new settings. Recovery codes and TOTP configuration cannot be set/updated using this API: each user must use the specific APIs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the username + @return UsersApiApiUpdateUserRequest +*/ +func (a *UsersApiService) UpdateUser(ctx context.Context, username string) UsersApiApiUpdateUserRequest { + return UsersApiApiUpdateUserRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UsersApiService) UpdateUserExecute(r UsersApiApiUpdateUserRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.UpdateUser") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.user == nil { + return localVarReturnValue, nil, reportError("user is required and must be specified") + } + + if r.disconnect != nil { + localVarQueryParams.Add("disconnect", parameterToString(*r.disconnect, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.user + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["APIKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-SFTPGO-API-KEY"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UsersApiApiUserForgotPasswordRequest struct { + ctx context.Context + ApiService *UsersApiService + username string +} + + +func (r UsersApiApiUserForgotPasswordRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UserForgotPasswordExecute(r) +} + +/* +UserForgotPassword Send a password reset code by email + +You must configure an SMTP server, the account must have a valid email address and must not have the "reset-password-disabled" restriction, in which case SFTPGo will send a code via email to reset the password. If the specified user does not exist, the request will be silently ignored (a success response will be returned) to avoid disclosing existing users + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the username + @return UsersApiApiUserForgotPasswordRequest +*/ +func (a *UsersApiService) UserForgotPassword(ctx context.Context, username string) UsersApiApiUserForgotPasswordRequest { + return UsersApiApiUserForgotPasswordRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UsersApiService) UserForgotPasswordExecute(r UsersApiApiUserForgotPasswordRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.UserForgotPassword") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{username}/forgot-password" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type UsersApiApiUserResetPasswordRequest struct { + ctx context.Context + ApiService *UsersApiService + username string + inlineObject5 *InlineObject5 +} + +func (r UsersApiApiUserResetPasswordRequest) InlineObject5(inlineObject5 InlineObject5) UsersApiApiUserResetPasswordRequest { + r.inlineObject5 = &inlineObject5 + return r +} + +func (r UsersApiApiUserResetPasswordRequest) Execute() (*ApiResponse, *http.Response, error) { + return r.ApiService.UserResetPasswordExecute(r) +} + +/* +UserResetPassword Reset the password + +Set a new password using the code received via email + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username the username + @return UsersApiApiUserResetPasswordRequest +*/ +func (a *UsersApiService) UserResetPassword(ctx context.Context, username string) UsersApiApiUserResetPasswordRequest { + return UsersApiApiUserResetPasswordRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return ApiResponse +func (a *UsersApiService) UserResetPasswordExecute(r UsersApiApiUserResetPasswordRequest) (*ApiResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.UserResetPassword") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{username}/reset-password" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterToString(r.username, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inlineObject5 == nil { + return localVarReturnValue, nil, reportError("inlineObject5 is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inlineObject5 + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/server/common/sftpgo/v2/openapi/client.go b/server/common/sftpgo/v2/openapi/client.go new file mode 100644 index 00000000..cbada1a2 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/client.go @@ -0,0 +1,602 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "io/ioutil" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) +) + +// APIClient manages communication with the SFTPGo API v2.2.2-dev +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + APIKeysApi *APIKeysApiService + + AdminsApi *AdminsApiService + + ConnectionsApi *ConnectionsApiService + + DataRetentionApi *DataRetentionApiService + + DefenderApi *DefenderApiService + + EventsApi *EventsApiService + + FoldersApi *FoldersApiService + + HealthcheckApi *HealthcheckApiService + + MaintenanceApi *MaintenanceApiService + + MetadataApi *MetadataApiService + + PublicSharesApi *PublicSharesApiService + + QuotaApi *QuotaApiService + + TokenApi *TokenApiService + + UserAPIsApi *UserAPIsApiService + + UsersApi *UsersApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.APIKeysApi = (*APIKeysApiService)(&c.common) + c.AdminsApi = (*AdminsApiService)(&c.common) + c.ConnectionsApi = (*ConnectionsApiService)(&c.common) + c.DataRetentionApi = (*DataRetentionApiService)(&c.common) + c.DefenderApi = (*DefenderApiService)(&c.common) + c.EventsApi = (*EventsApiService)(&c.common) + c.FoldersApi = (*FoldersApiService)(&c.common) + c.HealthcheckApi = (*HealthcheckApiService)(&c.common) + c.MaintenanceApi = (*MaintenanceApiService)(&c.common) + c.MetadataApi = (*MetadataApiService)(&c.common) + c.PublicSharesApi = (*PublicSharesApiService)(&c.common) + c.QuotaApi = (*QuotaApiService)(&c.common) + c.TokenApi = (*TokenApiService)(&c.common) + c.UserAPIsApi = (*UserAPIsApiService)(&c.common) + c.UsersApi = (*UsersApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) + } + + return fmt.Sprintf("%v", obj) +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(**os.File); ok { + *f, err = ioutil.TempFile("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(**os.File); ok { + _, err = bodyBuf.ReadFrom(*fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} diff --git a/server/common/sftpgo/v2/openapi/configuration.go b/server/common/sftpgo/v2/openapi/configuration.go new file mode 100644 index 00000000..00871164 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/configuration.go @@ -0,0 +1,236 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/3.1/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "/api/v2", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{ + "HealthcheckApiService.Healthz": { + { + URL: "/", + Description: "No description provided", + }, + }, + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/server/common/sftpgo/v2/openapi/docs/APIKeysApi.md b/server/common/sftpgo/v2/openapi/docs/APIKeysApi.md new file mode 100644 index 00000000..c39fa01c --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/APIKeysApi.md @@ -0,0 +1,361 @@ +# \APIKeysApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddApiKey**](APIKeysApi.md#AddApiKey) | **Post** /apikeys | Add API key +[**DeleteApiKey**](APIKeysApi.md#DeleteApiKey) | **Delete** /apikeys/{id} | Delete API key +[**GetApiKeyById**](APIKeysApi.md#GetApiKeyById) | **Get** /apikeys/{id} | Find API key by id +[**GetApiKeys**](APIKeysApi.md#GetApiKeys) | **Get** /apikeys | Get API keys +[**UpdateApiKey**](APIKeysApi.md#UpdateApiKey) | **Put** /apikeys/{id} | Update API key + + + +## AddApiKey + +> InlineResponse201 AddApiKey(ctx).AuthAPIKey(authAPIKey).Execute() + +Add API key + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + authAPIKey := *openapiclient.NewAuthAPIKey() // AuthAPIKey | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.APIKeysApi.AddApiKey(context.Background()).AuthAPIKey(authAPIKey).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `APIKeysApi.AddApiKey``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AddApiKey`: InlineResponse201 + fmt.Fprintf(os.Stdout, "Response from `APIKeysApi.AddApiKey`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddApiKeyRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authAPIKey** | [**AuthAPIKey**](AuthAPIKey.md) | | + +### Return type + +[**InlineResponse201**](InlineResponse201.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteApiKey + +> ApiResponse DeleteApiKey(ctx, id).Execute() + +Delete API key + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | the key id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.APIKeysApi.DeleteApiKey(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `APIKeysApi.DeleteApiKey``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DeleteApiKey`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `APIKeysApi.DeleteApiKey`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | the key id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteApiKeyRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetApiKeyById + +> AuthAPIKey GetApiKeyById(ctx, id).Execute() + +Find API key by id + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | the key id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.APIKeysApi.GetApiKeyById(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `APIKeysApi.GetApiKeyById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetApiKeyById`: AuthAPIKey + fmt.Fprintf(os.Stdout, "Response from `APIKeysApi.GetApiKeyById`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | the key id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetApiKeyByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**AuthAPIKey**](AuthAPIKey.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetApiKeys + +> []AuthAPIKey GetApiKeys(ctx).Offset(offset).Limit(limit).Order(order).Execute() + +Get API keys + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + offset := int32(56) // int32 | (optional) (default to 0) + limit := int32(56) // int32 | The maximum number of items to return. Max value is 500, default is 100 (optional) (default to 100) + order := "ASC" // string | Ordering API keys by id. Default ASC (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.APIKeysApi.GetApiKeys(context.Background()).Offset(offset).Limit(limit).Order(order).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `APIKeysApi.GetApiKeys``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetApiKeys`: []AuthAPIKey + fmt.Fprintf(os.Stdout, "Response from `APIKeysApi.GetApiKeys`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetApiKeysRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **offset** | **int32** | | [default to 0] + **limit** | **int32** | The maximum number of items to return. Max value is 500, default is 100 | [default to 100] + **order** | **string** | Ordering API keys by id. Default ASC | + +### Return type + +[**[]AuthAPIKey**](AuthAPIKey.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateApiKey + +> ApiResponse UpdateApiKey(ctx, id).AuthAPIKey(authAPIKey).Execute() + +Update API key + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | the key id + authAPIKey := *openapiclient.NewAuthAPIKey() // AuthAPIKey | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.APIKeysApi.UpdateApiKey(context.Background(), id).AuthAPIKey(authAPIKey).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `APIKeysApi.UpdateApiKey``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateApiKey`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `APIKeysApi.UpdateApiKey`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | the key id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateApiKeyRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **authAPIKey** | [**AuthAPIKey**](AuthAPIKey.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/Admin.md b/server/common/sftpgo/v2/openapi/docs/Admin.md new file mode 100644 index 00000000..f3373eca --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/Admin.md @@ -0,0 +1,342 @@ +# Admin + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int32** | | [optional] +**Status** | Pointer to **int32** | status: * `0` user is disabled, login is not allowed * `1` user is enabled | [optional] +**Username** | Pointer to **string** | username is unique | [optional] +**Description** | Pointer to **string** | optional description, for example the admin full name | [optional] +**Password** | Pointer to **string** | Admin password. For security reasons this field is omitted when you search/get admins | [optional] +**Email** | Pointer to **string** | | [optional] +**Permissions** | Pointer to [**[]AdminPermissions**](AdminPermissions.md) | | [optional] +**Filters** | Pointer to [**AdminFilters**](AdminFilters.md) | | [optional] +**AdditionalInfo** | Pointer to **string** | Free form text field | [optional] +**CreatedAt** | Pointer to **int64** | creation time as unix timestamp in milliseconds. It will be 0 for admins created before v2.2.0 | [optional] +**UpdatedAt** | Pointer to **int64** | last update time as unix timestamp in milliseconds | [optional] +**LastLogin** | Pointer to **int64** | Last user login as unix timestamp in milliseconds. It is saved at most once every 10 minutes | [optional] + +## Methods + +### NewAdmin + +`func NewAdmin() *Admin` + +NewAdmin instantiates a new Admin object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAdminWithDefaults + +`func NewAdminWithDefaults() *Admin` + +NewAdminWithDefaults instantiates a new Admin object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *Admin) GetId() int32` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Admin) GetIdOk() (*int32, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Admin) SetId(v int32)` + +SetId sets Id field to given value. + +### HasId + +`func (o *Admin) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetStatus + +`func (o *Admin) GetStatus() int32` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *Admin) GetStatusOk() (*int32, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *Admin) SetStatus(v int32)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *Admin) HasStatus() bool` + +HasStatus returns a boolean if a field has been set. + +### GetUsername + +`func (o *Admin) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *Admin) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *Admin) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *Admin) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetDescription + +`func (o *Admin) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *Admin) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *Admin) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *Admin) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetPassword + +`func (o *Admin) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *Admin) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *Admin) SetPassword(v string)` + +SetPassword sets Password field to given value. + +### HasPassword + +`func (o *Admin) HasPassword() bool` + +HasPassword returns a boolean if a field has been set. + +### GetEmail + +`func (o *Admin) GetEmail() string` + +GetEmail returns the Email field if non-nil, zero value otherwise. + +### GetEmailOk + +`func (o *Admin) GetEmailOk() (*string, bool)` + +GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEmail + +`func (o *Admin) SetEmail(v string)` + +SetEmail sets Email field to given value. + +### HasEmail + +`func (o *Admin) HasEmail() bool` + +HasEmail returns a boolean if a field has been set. + +### GetPermissions + +`func (o *Admin) GetPermissions() []AdminPermissions` + +GetPermissions returns the Permissions field if non-nil, zero value otherwise. + +### GetPermissionsOk + +`func (o *Admin) GetPermissionsOk() (*[]AdminPermissions, bool)` + +GetPermissionsOk returns a tuple with the Permissions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPermissions + +`func (o *Admin) SetPermissions(v []AdminPermissions)` + +SetPermissions sets Permissions field to given value. + +### HasPermissions + +`func (o *Admin) HasPermissions() bool` + +HasPermissions returns a boolean if a field has been set. + +### GetFilters + +`func (o *Admin) GetFilters() AdminFilters` + +GetFilters returns the Filters field if non-nil, zero value otherwise. + +### GetFiltersOk + +`func (o *Admin) GetFiltersOk() (*AdminFilters, bool)` + +GetFiltersOk returns a tuple with the Filters field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilters + +`func (o *Admin) SetFilters(v AdminFilters)` + +SetFilters sets Filters field to given value. + +### HasFilters + +`func (o *Admin) HasFilters() bool` + +HasFilters returns a boolean if a field has been set. + +### GetAdditionalInfo + +`func (o *Admin) GetAdditionalInfo() string` + +GetAdditionalInfo returns the AdditionalInfo field if non-nil, zero value otherwise. + +### GetAdditionalInfoOk + +`func (o *Admin) GetAdditionalInfoOk() (*string, bool)` + +GetAdditionalInfoOk returns a tuple with the AdditionalInfo field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAdditionalInfo + +`func (o *Admin) SetAdditionalInfo(v string)` + +SetAdditionalInfo sets AdditionalInfo field to given value. + +### HasAdditionalInfo + +`func (o *Admin) HasAdditionalInfo() bool` + +HasAdditionalInfo returns a boolean if a field has been set. + +### GetCreatedAt + +`func (o *Admin) GetCreatedAt() int64` + +GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise. + +### GetCreatedAtOk + +`func (o *Admin) GetCreatedAtOk() (*int64, bool)` + +GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCreatedAt + +`func (o *Admin) SetCreatedAt(v int64)` + +SetCreatedAt sets CreatedAt field to given value. + +### HasCreatedAt + +`func (o *Admin) HasCreatedAt() bool` + +HasCreatedAt returns a boolean if a field has been set. + +### GetUpdatedAt + +`func (o *Admin) GetUpdatedAt() int64` + +GetUpdatedAt returns the UpdatedAt field if non-nil, zero value otherwise. + +### GetUpdatedAtOk + +`func (o *Admin) GetUpdatedAtOk() (*int64, bool)` + +GetUpdatedAtOk returns a tuple with the UpdatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUpdatedAt + +`func (o *Admin) SetUpdatedAt(v int64)` + +SetUpdatedAt sets UpdatedAt field to given value. + +### HasUpdatedAt + +`func (o *Admin) HasUpdatedAt() bool` + +HasUpdatedAt returns a boolean if a field has been set. + +### GetLastLogin + +`func (o *Admin) GetLastLogin() int64` + +GetLastLogin returns the LastLogin field if non-nil, zero value otherwise. + +### GetLastLoginOk + +`func (o *Admin) GetLastLoginOk() (*int64, bool)` + +GetLastLoginOk returns a tuple with the LastLogin field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastLogin + +`func (o *Admin) SetLastLogin(v int64)` + +SetLastLogin sets LastLogin field to given value. + +### HasLastLogin + +`func (o *Admin) HasLastLogin() bool` + +HasLastLogin returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/AdminFilters.md b/server/common/sftpgo/v2/openapi/docs/AdminFilters.md new file mode 100644 index 00000000..c97469ff --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/AdminFilters.md @@ -0,0 +1,134 @@ +# AdminFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AllowList** | Pointer to **[]string** | only clients connecting from these IP/Mask are allowed. IP/Mask must be in CIDR notation as defined in RFC 4632 and RFC 4291, for example \"192.0.2.0/24\" or \"2001:db8::/32\" | [optional] +**AllowApiKeyAuth** | Pointer to **bool** | API key auth allows to impersonate this administrator with an API key | [optional] +**TotpConfig** | Pointer to [**AdminTOTPConfig**](AdminTOTPConfig.md) | | [optional] +**RecoveryCodes** | Pointer to [**[]RecoveryCode**](RecoveryCode.md) | | [optional] + +## Methods + +### NewAdminFilters + +`func NewAdminFilters() *AdminFilters` + +NewAdminFilters instantiates a new AdminFilters object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAdminFiltersWithDefaults + +`func NewAdminFiltersWithDefaults() *AdminFilters` + +NewAdminFiltersWithDefaults instantiates a new AdminFilters object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAllowList + +`func (o *AdminFilters) GetAllowList() []string` + +GetAllowList returns the AllowList field if non-nil, zero value otherwise. + +### GetAllowListOk + +`func (o *AdminFilters) GetAllowListOk() (*[]string, bool)` + +GetAllowListOk returns a tuple with the AllowList field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAllowList + +`func (o *AdminFilters) SetAllowList(v []string)` + +SetAllowList sets AllowList field to given value. + +### HasAllowList + +`func (o *AdminFilters) HasAllowList() bool` + +HasAllowList returns a boolean if a field has been set. + +### GetAllowApiKeyAuth + +`func (o *AdminFilters) GetAllowApiKeyAuth() bool` + +GetAllowApiKeyAuth returns the AllowApiKeyAuth field if non-nil, zero value otherwise. + +### GetAllowApiKeyAuthOk + +`func (o *AdminFilters) GetAllowApiKeyAuthOk() (*bool, bool)` + +GetAllowApiKeyAuthOk returns a tuple with the AllowApiKeyAuth field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAllowApiKeyAuth + +`func (o *AdminFilters) SetAllowApiKeyAuth(v bool)` + +SetAllowApiKeyAuth sets AllowApiKeyAuth field to given value. + +### HasAllowApiKeyAuth + +`func (o *AdminFilters) HasAllowApiKeyAuth() bool` + +HasAllowApiKeyAuth returns a boolean if a field has been set. + +### GetTotpConfig + +`func (o *AdminFilters) GetTotpConfig() AdminTOTPConfig` + +GetTotpConfig returns the TotpConfig field if non-nil, zero value otherwise. + +### GetTotpConfigOk + +`func (o *AdminFilters) GetTotpConfigOk() (*AdminTOTPConfig, bool)` + +GetTotpConfigOk returns a tuple with the TotpConfig field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotpConfig + +`func (o *AdminFilters) SetTotpConfig(v AdminTOTPConfig)` + +SetTotpConfig sets TotpConfig field to given value. + +### HasTotpConfig + +`func (o *AdminFilters) HasTotpConfig() bool` + +HasTotpConfig returns a boolean if a field has been set. + +### GetRecoveryCodes + +`func (o *AdminFilters) GetRecoveryCodes() []RecoveryCode` + +GetRecoveryCodes returns the RecoveryCodes field if non-nil, zero value otherwise. + +### GetRecoveryCodesOk + +`func (o *AdminFilters) GetRecoveryCodesOk() (*[]RecoveryCode, bool)` + +GetRecoveryCodesOk returns a tuple with the RecoveryCodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRecoveryCodes + +`func (o *AdminFilters) SetRecoveryCodes(v []RecoveryCode)` + +SetRecoveryCodes sets RecoveryCodes field to given value. + +### HasRecoveryCodes + +`func (o *AdminFilters) HasRecoveryCodes() bool` + +HasRecoveryCodes returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/AdminPermissions.md b/server/common/sftpgo/v2/openapi/docs/AdminPermissions.md new file mode 100644 index 00000000..28ed99de --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/AdminPermissions.md @@ -0,0 +1,43 @@ +# AdminPermissions + +## Enum + + +* `STAR` (value: `"*"`) + +* `ADD_USERS` (value: `"add_users"`) + +* `EDIT_USERS` (value: `"edit_users"`) + +* `DEL_USERS` (value: `"del_users"`) + +* `VIEW_USERS` (value: `"view_users"`) + +* `VIEW_CONNS` (value: `"view_conns"`) + +* `CLOSE_CONNS` (value: `"close_conns"`) + +* `VIEW_STATUS` (value: `"view_status"`) + +* `MANAGE_ADMINS` (value: `"manage_admins"`) + +* `MANAGE_APIKEYS` (value: `"manage_apikeys"`) + +* `QUOTA_SCANS` (value: `"quota_scans"`) + +* `MANAGE_SYSTEM` (value: `"manage_system"`) + +* `MANAGE_DEFENDER` (value: `"manage_defender"`) + +* `VIEW_DEFENDER` (value: `"view_defender"`) + +* `RETENTION_CHECKS` (value: `"retention_checks"`) + +* `METADATA_CHECKS` (value: `"metadata_checks"`) + +* `VIEW_EVENTS` (value: `"view_events"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/AdminProfile.md b/server/common/sftpgo/v2/openapi/docs/AdminProfile.md new file mode 100644 index 00000000..d7ccf7f8 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/AdminProfile.md @@ -0,0 +1,108 @@ +# AdminProfile + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Email** | Pointer to **string** | | [optional] +**Description** | Pointer to **string** | | [optional] +**AllowApiKeyAuth** | Pointer to **bool** | If enabled, you can impersonate this admin, in REST API, using an API key. If disabled admin credentials are required for impersonation | [optional] + +## Methods + +### NewAdminProfile + +`func NewAdminProfile() *AdminProfile` + +NewAdminProfile instantiates a new AdminProfile object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAdminProfileWithDefaults + +`func NewAdminProfileWithDefaults() *AdminProfile` + +NewAdminProfileWithDefaults instantiates a new AdminProfile object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetEmail + +`func (o *AdminProfile) GetEmail() string` + +GetEmail returns the Email field if non-nil, zero value otherwise. + +### GetEmailOk + +`func (o *AdminProfile) GetEmailOk() (*string, bool)` + +GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEmail + +`func (o *AdminProfile) SetEmail(v string)` + +SetEmail sets Email field to given value. + +### HasEmail + +`func (o *AdminProfile) HasEmail() bool` + +HasEmail returns a boolean if a field has been set. + +### GetDescription + +`func (o *AdminProfile) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *AdminProfile) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *AdminProfile) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *AdminProfile) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetAllowApiKeyAuth + +`func (o *AdminProfile) GetAllowApiKeyAuth() bool` + +GetAllowApiKeyAuth returns the AllowApiKeyAuth field if non-nil, zero value otherwise. + +### GetAllowApiKeyAuthOk + +`func (o *AdminProfile) GetAllowApiKeyAuthOk() (*bool, bool)` + +GetAllowApiKeyAuthOk returns a tuple with the AllowApiKeyAuth field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAllowApiKeyAuth + +`func (o *AdminProfile) SetAllowApiKeyAuth(v bool)` + +SetAllowApiKeyAuth sets AllowApiKeyAuth field to given value. + +### HasAllowApiKeyAuth + +`func (o *AdminProfile) HasAllowApiKeyAuth() bool` + +HasAllowApiKeyAuth returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/AdminTOTPConfig.md b/server/common/sftpgo/v2/openapi/docs/AdminTOTPConfig.md new file mode 100644 index 00000000..b6a92d6b --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/AdminTOTPConfig.md @@ -0,0 +1,108 @@ +# AdminTOTPConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Enabled** | Pointer to **bool** | | [optional] +**ConfigName** | Pointer to **string** | This name must be defined within the \"totp\" section of the SFTPGo configuration file. You will be unable to save a user/admin referencing a missing config_name | [optional] +**Secret** | Pointer to [**Secret**](Secret.md) | | [optional] + +## Methods + +### NewAdminTOTPConfig + +`func NewAdminTOTPConfig() *AdminTOTPConfig` + +NewAdminTOTPConfig instantiates a new AdminTOTPConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAdminTOTPConfigWithDefaults + +`func NewAdminTOTPConfigWithDefaults() *AdminTOTPConfig` + +NewAdminTOTPConfigWithDefaults instantiates a new AdminTOTPConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetEnabled + +`func (o *AdminTOTPConfig) GetEnabled() bool` + +GetEnabled returns the Enabled field if non-nil, zero value otherwise. + +### GetEnabledOk + +`func (o *AdminTOTPConfig) GetEnabledOk() (*bool, bool)` + +GetEnabledOk returns a tuple with the Enabled field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnabled + +`func (o *AdminTOTPConfig) SetEnabled(v bool)` + +SetEnabled sets Enabled field to given value. + +### HasEnabled + +`func (o *AdminTOTPConfig) HasEnabled() bool` + +HasEnabled returns a boolean if a field has been set. + +### GetConfigName + +`func (o *AdminTOTPConfig) GetConfigName() string` + +GetConfigName returns the ConfigName field if non-nil, zero value otherwise. + +### GetConfigNameOk + +`func (o *AdminTOTPConfig) GetConfigNameOk() (*string, bool)` + +GetConfigNameOk returns a tuple with the ConfigName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfigName + +`func (o *AdminTOTPConfig) SetConfigName(v string)` + +SetConfigName sets ConfigName field to given value. + +### HasConfigName + +`func (o *AdminTOTPConfig) HasConfigName() bool` + +HasConfigName returns a boolean if a field has been set. + +### GetSecret + +`func (o *AdminTOTPConfig) GetSecret() Secret` + +GetSecret returns the Secret field if non-nil, zero value otherwise. + +### GetSecretOk + +`func (o *AdminTOTPConfig) GetSecretOk() (*Secret, bool)` + +GetSecretOk returns a tuple with the Secret field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSecret + +`func (o *AdminTOTPConfig) SetSecret(v Secret)` + +SetSecret sets Secret field to given value. + +### HasSecret + +`func (o *AdminTOTPConfig) HasSecret() bool` + +HasSecret returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/AdminsApi.md b/server/common/sftpgo/v2/openapi/docs/AdminsApi.md new file mode 100644 index 00000000..5575e215 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/AdminsApi.md @@ -0,0 +1,1226 @@ +# \AdminsApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddAdmin**](AdminsApi.md#AddAdmin) | **Post** /admins | Add admin +[**AdminForgotPassword**](AdminsApi.md#AdminForgotPassword) | **Post** /admins/{username}/forgot-password | Send a password reset code by email +[**AdminResetPassword**](AdminsApi.md#AdminResetPassword) | **Post** /admins/{username}/reset-password | Reset the password +[**ChangeAdminPassword**](AdminsApi.md#ChangeAdminPassword) | **Put** /admin/changepwd | Change admin password +[**ChangeAdminPasswordDeprecated**](AdminsApi.md#ChangeAdminPasswordDeprecated) | **Put** /changepwd/admin | Change admin password +[**DeleteAdmin**](AdminsApi.md#DeleteAdmin) | **Delete** /admins/{username} | Delete admin +[**DisableAdmin2fa**](AdminsApi.md#DisableAdmin2fa) | **Put** /admins/{username}/2fa/disable | Disable second factor authentication +[**GenerateAdminRecoveryCodes**](AdminsApi.md#GenerateAdminRecoveryCodes) | **Post** /admin/2fa/recoverycodes | Generate recovery codes +[**GenerateAdminTotpSecret**](AdminsApi.md#GenerateAdminTotpSecret) | **Post** /admin/totp/generate | Generate a new TOTP secret +[**GetAdminByUsername**](AdminsApi.md#GetAdminByUsername) | **Get** /admins/{username} | Find admins by username +[**GetAdminProfile**](AdminsApi.md#GetAdminProfile) | **Get** /admin/profile | Get admin profile +[**GetAdminRecoveryCodes**](AdminsApi.md#GetAdminRecoveryCodes) | **Get** /admin/2fa/recoverycodes | Get recovery codes +[**GetAdminTotpConfigs**](AdminsApi.md#GetAdminTotpConfigs) | **Get** /admin/totp/configs | Get available TOTP configuration +[**GetAdmins**](AdminsApi.md#GetAdmins) | **Get** /admins | Get admins +[**SaveAdminTotpConfig**](AdminsApi.md#SaveAdminTotpConfig) | **Post** /admin/totp/save | Save a TOTP config +[**UpdateAdmin**](AdminsApi.md#UpdateAdmin) | **Put** /admins/{username} | Update admin +[**UpdateAdminProfile**](AdminsApi.md#UpdateAdminProfile) | **Put** /admin/profile | Update admin profile +[**ValidateAdminTotpSecret**](AdminsApi.md#ValidateAdminTotpSecret) | **Post** /admin/totp/validate | Validate a one time authentication code + + + +## AddAdmin + +> Admin AddAdmin(ctx).Admin(admin).Execute() + +Add admin + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + admin := *openapiclient.NewAdmin() // Admin | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.AddAdmin(context.Background()).Admin(admin).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.AddAdmin``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AddAdmin`: Admin + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.AddAdmin`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddAdminRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **admin** | [**Admin**](Admin.md) | | + +### Return type + +[**Admin**](Admin.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## AdminForgotPassword + +> ApiResponse AdminForgotPassword(ctx, username).Execute() + +Send a password reset code by email + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the admin username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.AdminForgotPassword(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.AdminForgotPassword``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AdminForgotPassword`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.AdminForgotPassword`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the admin username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAdminForgotPasswordRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## AdminResetPassword + +> ApiResponse AdminResetPassword(ctx, username).InlineObject4(inlineObject4).Execute() + +Reset the password + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the admin username + inlineObject4 := *openapiclient.NewInlineObject4() // InlineObject4 | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.AdminResetPassword(context.Background(), username).InlineObject4(inlineObject4).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.AdminResetPassword``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AdminResetPassword`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.AdminResetPassword`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the admin username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAdminResetPasswordRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **inlineObject4** | [**InlineObject4**](InlineObject4.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ChangeAdminPassword + +> ApiResponse ChangeAdminPassword(ctx).PwdChange(pwdChange).Execute() + +Change admin password + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + pwdChange := *openapiclient.NewPwdChange() // PwdChange | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.ChangeAdminPassword(context.Background()).PwdChange(pwdChange).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.ChangeAdminPassword``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ChangeAdminPassword`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.ChangeAdminPassword`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiChangeAdminPasswordRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pwdChange** | [**PwdChange**](PwdChange.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ChangeAdminPasswordDeprecated + +> ApiResponse ChangeAdminPasswordDeprecated(ctx).PwdChange(pwdChange).Execute() + +Change admin password + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + pwdChange := *openapiclient.NewPwdChange() // PwdChange | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.ChangeAdminPasswordDeprecated(context.Background()).PwdChange(pwdChange).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.ChangeAdminPasswordDeprecated``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ChangeAdminPasswordDeprecated`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.ChangeAdminPasswordDeprecated`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiChangeAdminPasswordDeprecatedRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pwdChange** | [**PwdChange**](PwdChange.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteAdmin + +> ApiResponse DeleteAdmin(ctx, username).Execute() + +Delete admin + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the admin username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.DeleteAdmin(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.DeleteAdmin``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DeleteAdmin`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.DeleteAdmin`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the admin username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteAdminRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DisableAdmin2fa + +> ApiResponse DisableAdmin2fa(ctx, username).Execute() + +Disable second factor authentication + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the admin username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.DisableAdmin2fa(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.DisableAdmin2fa``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DisableAdmin2fa`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.DisableAdmin2fa`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the admin username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDisableAdmin2faRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GenerateAdminRecoveryCodes + +> []string GenerateAdminRecoveryCodes(ctx).Execute() + +Generate recovery codes + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.GenerateAdminRecoveryCodes(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.GenerateAdminRecoveryCodes``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GenerateAdminRecoveryCodes`: []string + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.GenerateAdminRecoveryCodes`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGenerateAdminRecoveryCodesRequest struct via the builder pattern + + +### Return type + +**[]string** + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GenerateAdminTotpSecret + +> InlineResponse200 GenerateAdminTotpSecret(ctx).InlineObject1(inlineObject1).Execute() + +Generate a new TOTP secret + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + inlineObject1 := *openapiclient.NewInlineObject1() // InlineObject1 | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.GenerateAdminTotpSecret(context.Background()).InlineObject1(inlineObject1).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.GenerateAdminTotpSecret``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GenerateAdminTotpSecret`: InlineResponse200 + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.GenerateAdminTotpSecret`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGenerateAdminTotpSecretRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **inlineObject1** | [**InlineObject1**](InlineObject1.md) | | + +### Return type + +[**InlineResponse200**](InlineResponse200.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetAdminByUsername + +> Admin GetAdminByUsername(ctx, username).Execute() + +Find admins by username + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the admin username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.GetAdminByUsername(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.GetAdminByUsername``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetAdminByUsername`: Admin + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.GetAdminByUsername`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the admin username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetAdminByUsernameRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Admin**](Admin.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetAdminProfile + +> AdminProfile GetAdminProfile(ctx).Execute() + +Get admin profile + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.GetAdminProfile(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.GetAdminProfile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetAdminProfile`: AdminProfile + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.GetAdminProfile`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetAdminProfileRequest struct via the builder pattern + + +### Return type + +[**AdminProfile**](AdminProfile.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetAdminRecoveryCodes + +> []RecoveryCode GetAdminRecoveryCodes(ctx).Execute() + +Get recovery codes + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.GetAdminRecoveryCodes(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.GetAdminRecoveryCodes``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetAdminRecoveryCodes`: []RecoveryCode + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.GetAdminRecoveryCodes`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetAdminRecoveryCodesRequest struct via the builder pattern + + +### Return type + +[**[]RecoveryCode**](RecoveryCode.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetAdminTotpConfigs + +> []TOTPConfig GetAdminTotpConfigs(ctx).Execute() + +Get available TOTP configuration + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.GetAdminTotpConfigs(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.GetAdminTotpConfigs``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetAdminTotpConfigs`: []TOTPConfig + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.GetAdminTotpConfigs`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetAdminTotpConfigsRequest struct via the builder pattern + + +### Return type + +[**[]TOTPConfig**](TOTPConfig.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetAdmins + +> []Admin GetAdmins(ctx).Offset(offset).Limit(limit).Order(order).Execute() + +Get admins + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + offset := int32(56) // int32 | (optional) (default to 0) + limit := int32(56) // int32 | The maximum number of items to return. Max value is 500, default is 100 (optional) (default to 100) + order := "ASC" // string | Ordering admins by username. Default ASC (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.GetAdmins(context.Background()).Offset(offset).Limit(limit).Order(order).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.GetAdmins``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetAdmins`: []Admin + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.GetAdmins`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetAdminsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **offset** | **int32** | | [default to 0] + **limit** | **int32** | The maximum number of items to return. Max value is 500, default is 100 | [default to 100] + **order** | **string** | Ordering admins by username. Default ASC | + +### Return type + +[**[]Admin**](Admin.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SaveAdminTotpConfig + +> ApiResponse SaveAdminTotpConfig(ctx).AdminTOTPConfig(adminTOTPConfig).Execute() + +Save a TOTP config + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + adminTOTPConfig := *openapiclient.NewAdminTOTPConfig() // AdminTOTPConfig | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.SaveAdminTotpConfig(context.Background()).AdminTOTPConfig(adminTOTPConfig).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.SaveAdminTotpConfig``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `SaveAdminTotpConfig`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.SaveAdminTotpConfig`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiSaveAdminTotpConfigRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **adminTOTPConfig** | [**AdminTOTPConfig**](AdminTOTPConfig.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateAdmin + +> ApiResponse UpdateAdmin(ctx, username).Admin(admin).Execute() + +Update admin + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the admin username + admin := *openapiclient.NewAdmin() // Admin | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.UpdateAdmin(context.Background(), username).Admin(admin).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.UpdateAdmin``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateAdmin`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.UpdateAdmin`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the admin username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateAdminRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **admin** | [**Admin**](Admin.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateAdminProfile + +> ApiResponse UpdateAdminProfile(ctx).AdminProfile(adminProfile).Execute() + +Update admin profile + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + adminProfile := *openapiclient.NewAdminProfile() // AdminProfile | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.UpdateAdminProfile(context.Background()).AdminProfile(adminProfile).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.UpdateAdminProfile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateAdminProfile`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.UpdateAdminProfile`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateAdminProfileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **adminProfile** | [**AdminProfile**](AdminProfile.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ValidateAdminTotpSecret + +> ApiResponse ValidateAdminTotpSecret(ctx).InlineObject2(inlineObject2).Execute() + +Validate a one time authentication code + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + inlineObject2 := *openapiclient.NewInlineObject2() // InlineObject2 | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AdminsApi.ValidateAdminTotpSecret(context.Background()).InlineObject2(inlineObject2).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AdminsApi.ValidateAdminTotpSecret``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ValidateAdminTotpSecret`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `AdminsApi.ValidateAdminTotpSecret`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiValidateAdminTotpSecretRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **inlineObject2** | [**InlineObject2**](InlineObject2.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/ApiResponse.md b/server/common/sftpgo/v2/openapi/docs/ApiResponse.md new file mode 100644 index 00000000..d123ebba --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/ApiResponse.md @@ -0,0 +1,82 @@ +# ApiResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | Pointer to **string** | message, can be empty | [optional] +**Error** | Pointer to **string** | error description if any | [optional] + +## Methods + +### NewApiResponse + +`func NewApiResponse() *ApiResponse` + +NewApiResponse instantiates a new ApiResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewApiResponseWithDefaults + +`func NewApiResponseWithDefaults() *ApiResponse` + +NewApiResponseWithDefaults instantiates a new ApiResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetMessage + +`func (o *ApiResponse) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *ApiResponse) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *ApiResponse) SetMessage(v string)` + +SetMessage sets Message field to given value. + +### HasMessage + +`func (o *ApiResponse) HasMessage() bool` + +HasMessage returns a boolean if a field has been set. + +### GetError + +`func (o *ApiResponse) GetError() string` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *ApiResponse) GetErrorOk() (*string, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *ApiResponse) SetError(v string)` + +SetError sets Error field to given value. + +### HasError + +`func (o *ApiResponse) HasError() bool` + +HasError returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/AuthAPIKey.md b/server/common/sftpgo/v2/openapi/docs/AuthAPIKey.md new file mode 100644 index 00000000..5f5fdeea --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/AuthAPIKey.md @@ -0,0 +1,316 @@ +# AuthAPIKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | unique key identifier | [optional] +**Name** | Pointer to **string** | User friendly key name | [optional] +**Key** | Pointer to **string** | We store the hash of the key. This is just like a password. For security reasons this field is omitted when you search/get API keys | [optional] +**Scope** | Pointer to [**AuthAPIKeyScope**](AuthAPIKeyScope.md) | | [optional] +**CreatedAt** | Pointer to **int64** | creation time as unix timestamp in milliseconds | [optional] +**UpdatedAt** | Pointer to **int64** | last update time as unix timestamp in milliseconds | [optional] +**LastUseAt** | Pointer to **int64** | last use time as unix timestamp in milliseconds. It is saved at most once every 10 minutes | [optional] +**ExpiresAt** | Pointer to **int64** | expiration time as unix timestamp in milliseconds | [optional] +**Description** | Pointer to **string** | optional description | [optional] +**User** | Pointer to **string** | username associated with this API key. If empty and the scope is \"user scope\" the key can impersonate any user | [optional] +**Admin** | Pointer to **string** | admin associated with this API key. If empty and the scope is \"admin scope\" the key can impersonate any admin | [optional] + +## Methods + +### NewAuthAPIKey + +`func NewAuthAPIKey() *AuthAPIKey` + +NewAuthAPIKey instantiates a new AuthAPIKey object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAuthAPIKeyWithDefaults + +`func NewAuthAPIKeyWithDefaults() *AuthAPIKey` + +NewAuthAPIKeyWithDefaults instantiates a new AuthAPIKey object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *AuthAPIKey) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *AuthAPIKey) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *AuthAPIKey) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *AuthAPIKey) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetName + +`func (o *AuthAPIKey) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *AuthAPIKey) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *AuthAPIKey) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *AuthAPIKey) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetKey + +`func (o *AuthAPIKey) GetKey() string` + +GetKey returns the Key field if non-nil, zero value otherwise. + +### GetKeyOk + +`func (o *AuthAPIKey) GetKeyOk() (*string, bool)` + +GetKeyOk returns a tuple with the Key field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKey + +`func (o *AuthAPIKey) SetKey(v string)` + +SetKey sets Key field to given value. + +### HasKey + +`func (o *AuthAPIKey) HasKey() bool` + +HasKey returns a boolean if a field has been set. + +### GetScope + +`func (o *AuthAPIKey) GetScope() AuthAPIKeyScope` + +GetScope returns the Scope field if non-nil, zero value otherwise. + +### GetScopeOk + +`func (o *AuthAPIKey) GetScopeOk() (*AuthAPIKeyScope, bool)` + +GetScopeOk returns a tuple with the Scope field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetScope + +`func (o *AuthAPIKey) SetScope(v AuthAPIKeyScope)` + +SetScope sets Scope field to given value. + +### HasScope + +`func (o *AuthAPIKey) HasScope() bool` + +HasScope returns a boolean if a field has been set. + +### GetCreatedAt + +`func (o *AuthAPIKey) GetCreatedAt() int64` + +GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise. + +### GetCreatedAtOk + +`func (o *AuthAPIKey) GetCreatedAtOk() (*int64, bool)` + +GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCreatedAt + +`func (o *AuthAPIKey) SetCreatedAt(v int64)` + +SetCreatedAt sets CreatedAt field to given value. + +### HasCreatedAt + +`func (o *AuthAPIKey) HasCreatedAt() bool` + +HasCreatedAt returns a boolean if a field has been set. + +### GetUpdatedAt + +`func (o *AuthAPIKey) GetUpdatedAt() int64` + +GetUpdatedAt returns the UpdatedAt field if non-nil, zero value otherwise. + +### GetUpdatedAtOk + +`func (o *AuthAPIKey) GetUpdatedAtOk() (*int64, bool)` + +GetUpdatedAtOk returns a tuple with the UpdatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUpdatedAt + +`func (o *AuthAPIKey) SetUpdatedAt(v int64)` + +SetUpdatedAt sets UpdatedAt field to given value. + +### HasUpdatedAt + +`func (o *AuthAPIKey) HasUpdatedAt() bool` + +HasUpdatedAt returns a boolean if a field has been set. + +### GetLastUseAt + +`func (o *AuthAPIKey) GetLastUseAt() int64` + +GetLastUseAt returns the LastUseAt field if non-nil, zero value otherwise. + +### GetLastUseAtOk + +`func (o *AuthAPIKey) GetLastUseAtOk() (*int64, bool)` + +GetLastUseAtOk returns a tuple with the LastUseAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastUseAt + +`func (o *AuthAPIKey) SetLastUseAt(v int64)` + +SetLastUseAt sets LastUseAt field to given value. + +### HasLastUseAt + +`func (o *AuthAPIKey) HasLastUseAt() bool` + +HasLastUseAt returns a boolean if a field has been set. + +### GetExpiresAt + +`func (o *AuthAPIKey) GetExpiresAt() int64` + +GetExpiresAt returns the ExpiresAt field if non-nil, zero value otherwise. + +### GetExpiresAtOk + +`func (o *AuthAPIKey) GetExpiresAtOk() (*int64, bool)` + +GetExpiresAtOk returns a tuple with the ExpiresAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetExpiresAt + +`func (o *AuthAPIKey) SetExpiresAt(v int64)` + +SetExpiresAt sets ExpiresAt field to given value. + +### HasExpiresAt + +`func (o *AuthAPIKey) HasExpiresAt() bool` + +HasExpiresAt returns a boolean if a field has been set. + +### GetDescription + +`func (o *AuthAPIKey) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *AuthAPIKey) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *AuthAPIKey) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *AuthAPIKey) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetUser + +`func (o *AuthAPIKey) GetUser() string` + +GetUser returns the User field if non-nil, zero value otherwise. + +### GetUserOk + +`func (o *AuthAPIKey) GetUserOk() (*string, bool)` + +GetUserOk returns a tuple with the User field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUser + +`func (o *AuthAPIKey) SetUser(v string)` + +SetUser sets User field to given value. + +### HasUser + +`func (o *AuthAPIKey) HasUser() bool` + +HasUser returns a boolean if a field has been set. + +### GetAdmin + +`func (o *AuthAPIKey) GetAdmin() string` + +GetAdmin returns the Admin field if non-nil, zero value otherwise. + +### GetAdminOk + +`func (o *AuthAPIKey) GetAdminOk() (*string, bool)` + +GetAdminOk returns a tuple with the Admin field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAdmin + +`func (o *AuthAPIKey) SetAdmin(v string)` + +SetAdmin sets Admin field to given value. + +### HasAdmin + +`func (o *AuthAPIKey) HasAdmin() bool` + +HasAdmin returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/AuthAPIKeyScope.md b/server/common/sftpgo/v2/openapi/docs/AuthAPIKeyScope.md new file mode 100644 index 00000000..61aed5a3 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/AuthAPIKeyScope.md @@ -0,0 +1,13 @@ +# AuthAPIKeyScope + +## Enum + + +* `_1` (value: `1`) + +* `_2` (value: `2`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/AzureBlobFsConfig.md b/server/common/sftpgo/v2/openapi/docs/AzureBlobFsConfig.md new file mode 100644 index 00000000..74d074c3 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/AzureBlobFsConfig.md @@ -0,0 +1,290 @@ +# AzureBlobFsConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Container** | Pointer to **string** | | [optional] +**AccountName** | Pointer to **string** | Storage Account Name, leave blank to use SAS URL | [optional] +**AccountKey** | Pointer to [**Secret**](Secret.md) | | [optional] +**SasUrl** | Pointer to [**Secret**](Secret.md) | | [optional] +**Endpoint** | Pointer to **string** | optional endpoint. Default is \"blob.core.windows.net\". If you use the emulator the endpoint must include the protocol, for example \"http://127.0.0.1:10000\" | [optional] +**UploadPartSize** | Pointer to **int32** | the buffer size (in MB) to use for multipart uploads. If this value is set to zero, the default value (4MB) will be used. | [optional] +**UploadConcurrency** | Pointer to **int32** | the number of parts to upload in parallel. If this value is set to zero, the default value (2) will be used | [optional] +**AccessTier** | Pointer to **string** | | [optional] +**KeyPrefix** | Pointer to **string** | key_prefix is similar to a chroot directory for a local filesystem. If specified the user will only see contents that starts with this prefix and so you can restrict access to a specific virtual folder. The prefix, if not empty, must not start with \"/\" and must end with \"/\". If empty the whole container contents will be available | [optional] +**UseEmulator** | Pointer to **bool** | | [optional] + +## Methods + +### NewAzureBlobFsConfig + +`func NewAzureBlobFsConfig() *AzureBlobFsConfig` + +NewAzureBlobFsConfig instantiates a new AzureBlobFsConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAzureBlobFsConfigWithDefaults + +`func NewAzureBlobFsConfigWithDefaults() *AzureBlobFsConfig` + +NewAzureBlobFsConfigWithDefaults instantiates a new AzureBlobFsConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetContainer + +`func (o *AzureBlobFsConfig) GetContainer() string` + +GetContainer returns the Container field if non-nil, zero value otherwise. + +### GetContainerOk + +`func (o *AzureBlobFsConfig) GetContainerOk() (*string, bool)` + +GetContainerOk returns a tuple with the Container field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContainer + +`func (o *AzureBlobFsConfig) SetContainer(v string)` + +SetContainer sets Container field to given value. + +### HasContainer + +`func (o *AzureBlobFsConfig) HasContainer() bool` + +HasContainer returns a boolean if a field has been set. + +### GetAccountName + +`func (o *AzureBlobFsConfig) GetAccountName() string` + +GetAccountName returns the AccountName field if non-nil, zero value otherwise. + +### GetAccountNameOk + +`func (o *AzureBlobFsConfig) GetAccountNameOk() (*string, bool)` + +GetAccountNameOk returns a tuple with the AccountName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAccountName + +`func (o *AzureBlobFsConfig) SetAccountName(v string)` + +SetAccountName sets AccountName field to given value. + +### HasAccountName + +`func (o *AzureBlobFsConfig) HasAccountName() bool` + +HasAccountName returns a boolean if a field has been set. + +### GetAccountKey + +`func (o *AzureBlobFsConfig) GetAccountKey() Secret` + +GetAccountKey returns the AccountKey field if non-nil, zero value otherwise. + +### GetAccountKeyOk + +`func (o *AzureBlobFsConfig) GetAccountKeyOk() (*Secret, bool)` + +GetAccountKeyOk returns a tuple with the AccountKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAccountKey + +`func (o *AzureBlobFsConfig) SetAccountKey(v Secret)` + +SetAccountKey sets AccountKey field to given value. + +### HasAccountKey + +`func (o *AzureBlobFsConfig) HasAccountKey() bool` + +HasAccountKey returns a boolean if a field has been set. + +### GetSasUrl + +`func (o *AzureBlobFsConfig) GetSasUrl() Secret` + +GetSasUrl returns the SasUrl field if non-nil, zero value otherwise. + +### GetSasUrlOk + +`func (o *AzureBlobFsConfig) GetSasUrlOk() (*Secret, bool)` + +GetSasUrlOk returns a tuple with the SasUrl field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSasUrl + +`func (o *AzureBlobFsConfig) SetSasUrl(v Secret)` + +SetSasUrl sets SasUrl field to given value. + +### HasSasUrl + +`func (o *AzureBlobFsConfig) HasSasUrl() bool` + +HasSasUrl returns a boolean if a field has been set. + +### GetEndpoint + +`func (o *AzureBlobFsConfig) GetEndpoint() string` + +GetEndpoint returns the Endpoint field if non-nil, zero value otherwise. + +### GetEndpointOk + +`func (o *AzureBlobFsConfig) GetEndpointOk() (*string, bool)` + +GetEndpointOk returns a tuple with the Endpoint field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEndpoint + +`func (o *AzureBlobFsConfig) SetEndpoint(v string)` + +SetEndpoint sets Endpoint field to given value. + +### HasEndpoint + +`func (o *AzureBlobFsConfig) HasEndpoint() bool` + +HasEndpoint returns a boolean if a field has been set. + +### GetUploadPartSize + +`func (o *AzureBlobFsConfig) GetUploadPartSize() int32` + +GetUploadPartSize returns the UploadPartSize field if non-nil, zero value otherwise. + +### GetUploadPartSizeOk + +`func (o *AzureBlobFsConfig) GetUploadPartSizeOk() (*int32, bool)` + +GetUploadPartSizeOk returns a tuple with the UploadPartSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUploadPartSize + +`func (o *AzureBlobFsConfig) SetUploadPartSize(v int32)` + +SetUploadPartSize sets UploadPartSize field to given value. + +### HasUploadPartSize + +`func (o *AzureBlobFsConfig) HasUploadPartSize() bool` + +HasUploadPartSize returns a boolean if a field has been set. + +### GetUploadConcurrency + +`func (o *AzureBlobFsConfig) GetUploadConcurrency() int32` + +GetUploadConcurrency returns the UploadConcurrency field if non-nil, zero value otherwise. + +### GetUploadConcurrencyOk + +`func (o *AzureBlobFsConfig) GetUploadConcurrencyOk() (*int32, bool)` + +GetUploadConcurrencyOk returns a tuple with the UploadConcurrency field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUploadConcurrency + +`func (o *AzureBlobFsConfig) SetUploadConcurrency(v int32)` + +SetUploadConcurrency sets UploadConcurrency field to given value. + +### HasUploadConcurrency + +`func (o *AzureBlobFsConfig) HasUploadConcurrency() bool` + +HasUploadConcurrency returns a boolean if a field has been set. + +### GetAccessTier + +`func (o *AzureBlobFsConfig) GetAccessTier() string` + +GetAccessTier returns the AccessTier field if non-nil, zero value otherwise. + +### GetAccessTierOk + +`func (o *AzureBlobFsConfig) GetAccessTierOk() (*string, bool)` + +GetAccessTierOk returns a tuple with the AccessTier field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAccessTier + +`func (o *AzureBlobFsConfig) SetAccessTier(v string)` + +SetAccessTier sets AccessTier field to given value. + +### HasAccessTier + +`func (o *AzureBlobFsConfig) HasAccessTier() bool` + +HasAccessTier returns a boolean if a field has been set. + +### GetKeyPrefix + +`func (o *AzureBlobFsConfig) GetKeyPrefix() string` + +GetKeyPrefix returns the KeyPrefix field if non-nil, zero value otherwise. + +### GetKeyPrefixOk + +`func (o *AzureBlobFsConfig) GetKeyPrefixOk() (*string, bool)` + +GetKeyPrefixOk returns a tuple with the KeyPrefix field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKeyPrefix + +`func (o *AzureBlobFsConfig) SetKeyPrefix(v string)` + +SetKeyPrefix sets KeyPrefix field to given value. + +### HasKeyPrefix + +`func (o *AzureBlobFsConfig) HasKeyPrefix() bool` + +HasKeyPrefix returns a boolean if a field has been set. + +### GetUseEmulator + +`func (o *AzureBlobFsConfig) GetUseEmulator() bool` + +GetUseEmulator returns the UseEmulator field if non-nil, zero value otherwise. + +### GetUseEmulatorOk + +`func (o *AzureBlobFsConfig) GetUseEmulatorOk() (*bool, bool)` + +GetUseEmulatorOk returns a tuple with the UseEmulator field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUseEmulator + +`func (o *AzureBlobFsConfig) SetUseEmulator(v bool)` + +SetUseEmulator sets UseEmulator field to given value. + +### HasUseEmulator + +`func (o *AzureBlobFsConfig) HasUseEmulator() bool` + +HasUseEmulator returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/BackupData.md b/server/common/sftpgo/v2/openapi/docs/BackupData.md new file mode 100644 index 00000000..964e98a9 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/BackupData.md @@ -0,0 +1,186 @@ +# BackupData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Users** | Pointer to [**[]User**](User.md) | | [optional] +**Folders** | Pointer to [**[]BaseVirtualFolder**](BaseVirtualFolder.md) | | [optional] +**Admins** | Pointer to [**[]Admin**](Admin.md) | | [optional] +**ApiKeys** | Pointer to [**[]AuthAPIKey**](AuthAPIKey.md) | | [optional] +**Shares** | Pointer to [**[]Share**](Share.md) | | [optional] +**Version** | Pointer to **int32** | | [optional] + +## Methods + +### NewBackupData + +`func NewBackupData() *BackupData` + +NewBackupData instantiates a new BackupData object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBackupDataWithDefaults + +`func NewBackupDataWithDefaults() *BackupData` + +NewBackupDataWithDefaults instantiates a new BackupData object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetUsers + +`func (o *BackupData) GetUsers() []User` + +GetUsers returns the Users field if non-nil, zero value otherwise. + +### GetUsersOk + +`func (o *BackupData) GetUsersOk() (*[]User, bool)` + +GetUsersOk returns a tuple with the Users field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsers + +`func (o *BackupData) SetUsers(v []User)` + +SetUsers sets Users field to given value. + +### HasUsers + +`func (o *BackupData) HasUsers() bool` + +HasUsers returns a boolean if a field has been set. + +### GetFolders + +`func (o *BackupData) GetFolders() []BaseVirtualFolder` + +GetFolders returns the Folders field if non-nil, zero value otherwise. + +### GetFoldersOk + +`func (o *BackupData) GetFoldersOk() (*[]BaseVirtualFolder, bool)` + +GetFoldersOk returns a tuple with the Folders field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFolders + +`func (o *BackupData) SetFolders(v []BaseVirtualFolder)` + +SetFolders sets Folders field to given value. + +### HasFolders + +`func (o *BackupData) HasFolders() bool` + +HasFolders returns a boolean if a field has been set. + +### GetAdmins + +`func (o *BackupData) GetAdmins() []Admin` + +GetAdmins returns the Admins field if non-nil, zero value otherwise. + +### GetAdminsOk + +`func (o *BackupData) GetAdminsOk() (*[]Admin, bool)` + +GetAdminsOk returns a tuple with the Admins field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAdmins + +`func (o *BackupData) SetAdmins(v []Admin)` + +SetAdmins sets Admins field to given value. + +### HasAdmins + +`func (o *BackupData) HasAdmins() bool` + +HasAdmins returns a boolean if a field has been set. + +### GetApiKeys + +`func (o *BackupData) GetApiKeys() []AuthAPIKey` + +GetApiKeys returns the ApiKeys field if non-nil, zero value otherwise. + +### GetApiKeysOk + +`func (o *BackupData) GetApiKeysOk() (*[]AuthAPIKey, bool)` + +GetApiKeysOk returns a tuple with the ApiKeys field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetApiKeys + +`func (o *BackupData) SetApiKeys(v []AuthAPIKey)` + +SetApiKeys sets ApiKeys field to given value. + +### HasApiKeys + +`func (o *BackupData) HasApiKeys() bool` + +HasApiKeys returns a boolean if a field has been set. + +### GetShares + +`func (o *BackupData) GetShares() []Share` + +GetShares returns the Shares field if non-nil, zero value otherwise. + +### GetSharesOk + +`func (o *BackupData) GetSharesOk() (*[]Share, bool)` + +GetSharesOk returns a tuple with the Shares field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShares + +`func (o *BackupData) SetShares(v []Share)` + +SetShares sets Shares field to given value. + +### HasShares + +`func (o *BackupData) HasShares() bool` + +HasShares returns a boolean if a field has been set. + +### GetVersion + +`func (o *BackupData) GetVersion() int32` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *BackupData) GetVersionOk() (*int32, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *BackupData) SetVersion(v int32)` + +SetVersion sets Version field to given value. + +### HasVersion + +`func (o *BackupData) HasVersion() bool` + +HasVersion returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/BanStatus.md b/server/common/sftpgo/v2/openapi/docs/BanStatus.md new file mode 100644 index 00000000..26592496 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/BanStatus.md @@ -0,0 +1,66 @@ +# BanStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DateTime** | Pointer to **NullableTime** | if null the host is not banned | [optional] + +## Methods + +### NewBanStatus + +`func NewBanStatus() *BanStatus` + +NewBanStatus instantiates a new BanStatus object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBanStatusWithDefaults + +`func NewBanStatusWithDefaults() *BanStatus` + +NewBanStatusWithDefaults instantiates a new BanStatus object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetDateTime + +`func (o *BanStatus) GetDateTime() time.Time` + +GetDateTime returns the DateTime field if non-nil, zero value otherwise. + +### GetDateTimeOk + +`func (o *BanStatus) GetDateTimeOk() (*time.Time, bool)` + +GetDateTimeOk returns a tuple with the DateTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDateTime + +`func (o *BanStatus) SetDateTime(v time.Time)` + +SetDateTime sets DateTime field to given value. + +### HasDateTime + +`func (o *BanStatus) HasDateTime() bool` + +HasDateTime returns a boolean if a field has been set. + +### SetDateTimeNil + +`func (o *BanStatus) SetDateTimeNil(b bool)` + + SetDateTimeNil sets the value for DateTime to be an explicit nil + +### UnsetDateTime +`func (o *BanStatus) UnsetDateTime()` + +UnsetDateTime ensures that no value is present for DateTime, not even an explicit nil + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/BandwidthLimit.md b/server/common/sftpgo/v2/openapi/docs/BandwidthLimit.md new file mode 100644 index 00000000..904a9c98 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/BandwidthLimit.md @@ -0,0 +1,108 @@ +# BandwidthLimit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Sources** | Pointer to **[]string** | Source networks in CIDR notation as defined in RFC 4632 and RFC 4291 for example `192.0.2.0/24` or `2001:db8::/32`. The limit applies if the defined networks contain the client IP | [optional] +**UploadBandwidth** | Pointer to **int32** | Maximum upload bandwidth as KB/s, 0 means unlimited | [optional] +**DownloadBandwidth** | Pointer to **int32** | Maximum download bandwidth as KB/s, 0 means unlimited | [optional] + +## Methods + +### NewBandwidthLimit + +`func NewBandwidthLimit() *BandwidthLimit` + +NewBandwidthLimit instantiates a new BandwidthLimit object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBandwidthLimitWithDefaults + +`func NewBandwidthLimitWithDefaults() *BandwidthLimit` + +NewBandwidthLimitWithDefaults instantiates a new BandwidthLimit object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetSources + +`func (o *BandwidthLimit) GetSources() []string` + +GetSources returns the Sources field if non-nil, zero value otherwise. + +### GetSourcesOk + +`func (o *BandwidthLimit) GetSourcesOk() (*[]string, bool)` + +GetSourcesOk returns a tuple with the Sources field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSources + +`func (o *BandwidthLimit) SetSources(v []string)` + +SetSources sets Sources field to given value. + +### HasSources + +`func (o *BandwidthLimit) HasSources() bool` + +HasSources returns a boolean if a field has been set. + +### GetUploadBandwidth + +`func (o *BandwidthLimit) GetUploadBandwidth() int32` + +GetUploadBandwidth returns the UploadBandwidth field if non-nil, zero value otherwise. + +### GetUploadBandwidthOk + +`func (o *BandwidthLimit) GetUploadBandwidthOk() (*int32, bool)` + +GetUploadBandwidthOk returns a tuple with the UploadBandwidth field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUploadBandwidth + +`func (o *BandwidthLimit) SetUploadBandwidth(v int32)` + +SetUploadBandwidth sets UploadBandwidth field to given value. + +### HasUploadBandwidth + +`func (o *BandwidthLimit) HasUploadBandwidth() bool` + +HasUploadBandwidth returns a boolean if a field has been set. + +### GetDownloadBandwidth + +`func (o *BandwidthLimit) GetDownloadBandwidth() int32` + +GetDownloadBandwidth returns the DownloadBandwidth field if non-nil, zero value otherwise. + +### GetDownloadBandwidthOk + +`func (o *BandwidthLimit) GetDownloadBandwidthOk() (*int32, bool)` + +GetDownloadBandwidthOk returns a tuple with the DownloadBandwidth field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDownloadBandwidth + +`func (o *BandwidthLimit) SetDownloadBandwidth(v int32)` + +SetDownloadBandwidth sets DownloadBandwidth field to given value. + +### HasDownloadBandwidth + +`func (o *BandwidthLimit) HasDownloadBandwidth() bool` + +HasDownloadBandwidth returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/BaseTOTPConfig.md b/server/common/sftpgo/v2/openapi/docs/BaseTOTPConfig.md new file mode 100644 index 00000000..abdc87fd --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/BaseTOTPConfig.md @@ -0,0 +1,108 @@ +# BaseTOTPConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Enabled** | Pointer to **bool** | | [optional] +**ConfigName** | Pointer to **string** | This name must be defined within the \"totp\" section of the SFTPGo configuration file. You will be unable to save a user/admin referencing a missing config_name | [optional] +**Secret** | Pointer to [**Secret**](Secret.md) | | [optional] + +## Methods + +### NewBaseTOTPConfig + +`func NewBaseTOTPConfig() *BaseTOTPConfig` + +NewBaseTOTPConfig instantiates a new BaseTOTPConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBaseTOTPConfigWithDefaults + +`func NewBaseTOTPConfigWithDefaults() *BaseTOTPConfig` + +NewBaseTOTPConfigWithDefaults instantiates a new BaseTOTPConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetEnabled + +`func (o *BaseTOTPConfig) GetEnabled() bool` + +GetEnabled returns the Enabled field if non-nil, zero value otherwise. + +### GetEnabledOk + +`func (o *BaseTOTPConfig) GetEnabledOk() (*bool, bool)` + +GetEnabledOk returns a tuple with the Enabled field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnabled + +`func (o *BaseTOTPConfig) SetEnabled(v bool)` + +SetEnabled sets Enabled field to given value. + +### HasEnabled + +`func (o *BaseTOTPConfig) HasEnabled() bool` + +HasEnabled returns a boolean if a field has been set. + +### GetConfigName + +`func (o *BaseTOTPConfig) GetConfigName() string` + +GetConfigName returns the ConfigName field if non-nil, zero value otherwise. + +### GetConfigNameOk + +`func (o *BaseTOTPConfig) GetConfigNameOk() (*string, bool)` + +GetConfigNameOk returns a tuple with the ConfigName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfigName + +`func (o *BaseTOTPConfig) SetConfigName(v string)` + +SetConfigName sets ConfigName field to given value. + +### HasConfigName + +`func (o *BaseTOTPConfig) HasConfigName() bool` + +HasConfigName returns a boolean if a field has been set. + +### GetSecret + +`func (o *BaseTOTPConfig) GetSecret() Secret` + +GetSecret returns the Secret field if non-nil, zero value otherwise. + +### GetSecretOk + +`func (o *BaseTOTPConfig) GetSecretOk() (*Secret, bool)` + +GetSecretOk returns a tuple with the Secret field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSecret + +`func (o *BaseTOTPConfig) SetSecret(v Secret)` + +SetSecret sets Secret field to given value. + +### HasSecret + +`func (o *BaseTOTPConfig) HasSecret() bool` + +HasSecret returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/BaseVirtualFolder.md b/server/common/sftpgo/v2/openapi/docs/BaseVirtualFolder.md new file mode 100644 index 00000000..01de55e7 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/BaseVirtualFolder.md @@ -0,0 +1,264 @@ +# BaseVirtualFolder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int32** | | [optional] +**Name** | Pointer to **string** | unique name for this virtual folder | [optional] +**MappedPath** | Pointer to **string** | absolute filesystem path to use as virtual folder | [optional] +**Description** | Pointer to **string** | optional description | [optional] +**UsedQuotaSize** | Pointer to **int64** | | [optional] +**UsedQuotaFiles** | Pointer to **int32** | | [optional] +**LastQuotaUpdate** | Pointer to **int64** | Last quota update as unix timestamp in milliseconds | [optional] +**Users** | Pointer to **[]string** | list of usernames associated with this virtual folder | [optional] +**Filesystem** | Pointer to [**FilesystemConfig**](FilesystemConfig.md) | | [optional] + +## Methods + +### NewBaseVirtualFolder + +`func NewBaseVirtualFolder() *BaseVirtualFolder` + +NewBaseVirtualFolder instantiates a new BaseVirtualFolder object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBaseVirtualFolderWithDefaults + +`func NewBaseVirtualFolderWithDefaults() *BaseVirtualFolder` + +NewBaseVirtualFolderWithDefaults instantiates a new BaseVirtualFolder object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *BaseVirtualFolder) GetId() int32` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *BaseVirtualFolder) GetIdOk() (*int32, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *BaseVirtualFolder) SetId(v int32)` + +SetId sets Id field to given value. + +### HasId + +`func (o *BaseVirtualFolder) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetName + +`func (o *BaseVirtualFolder) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *BaseVirtualFolder) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *BaseVirtualFolder) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *BaseVirtualFolder) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetMappedPath + +`func (o *BaseVirtualFolder) GetMappedPath() string` + +GetMappedPath returns the MappedPath field if non-nil, zero value otherwise. + +### GetMappedPathOk + +`func (o *BaseVirtualFolder) GetMappedPathOk() (*string, bool)` + +GetMappedPathOk returns a tuple with the MappedPath field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMappedPath + +`func (o *BaseVirtualFolder) SetMappedPath(v string)` + +SetMappedPath sets MappedPath field to given value. + +### HasMappedPath + +`func (o *BaseVirtualFolder) HasMappedPath() bool` + +HasMappedPath returns a boolean if a field has been set. + +### GetDescription + +`func (o *BaseVirtualFolder) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *BaseVirtualFolder) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *BaseVirtualFolder) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *BaseVirtualFolder) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetUsedQuotaSize + +`func (o *BaseVirtualFolder) GetUsedQuotaSize() int64` + +GetUsedQuotaSize returns the UsedQuotaSize field if non-nil, zero value otherwise. + +### GetUsedQuotaSizeOk + +`func (o *BaseVirtualFolder) GetUsedQuotaSizeOk() (*int64, bool)` + +GetUsedQuotaSizeOk returns a tuple with the UsedQuotaSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedQuotaSize + +`func (o *BaseVirtualFolder) SetUsedQuotaSize(v int64)` + +SetUsedQuotaSize sets UsedQuotaSize field to given value. + +### HasUsedQuotaSize + +`func (o *BaseVirtualFolder) HasUsedQuotaSize() bool` + +HasUsedQuotaSize returns a boolean if a field has been set. + +### GetUsedQuotaFiles + +`func (o *BaseVirtualFolder) GetUsedQuotaFiles() int32` + +GetUsedQuotaFiles returns the UsedQuotaFiles field if non-nil, zero value otherwise. + +### GetUsedQuotaFilesOk + +`func (o *BaseVirtualFolder) GetUsedQuotaFilesOk() (*int32, bool)` + +GetUsedQuotaFilesOk returns a tuple with the UsedQuotaFiles field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedQuotaFiles + +`func (o *BaseVirtualFolder) SetUsedQuotaFiles(v int32)` + +SetUsedQuotaFiles sets UsedQuotaFiles field to given value. + +### HasUsedQuotaFiles + +`func (o *BaseVirtualFolder) HasUsedQuotaFiles() bool` + +HasUsedQuotaFiles returns a boolean if a field has been set. + +### GetLastQuotaUpdate + +`func (o *BaseVirtualFolder) GetLastQuotaUpdate() int64` + +GetLastQuotaUpdate returns the LastQuotaUpdate field if non-nil, zero value otherwise. + +### GetLastQuotaUpdateOk + +`func (o *BaseVirtualFolder) GetLastQuotaUpdateOk() (*int64, bool)` + +GetLastQuotaUpdateOk returns a tuple with the LastQuotaUpdate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastQuotaUpdate + +`func (o *BaseVirtualFolder) SetLastQuotaUpdate(v int64)` + +SetLastQuotaUpdate sets LastQuotaUpdate field to given value. + +### HasLastQuotaUpdate + +`func (o *BaseVirtualFolder) HasLastQuotaUpdate() bool` + +HasLastQuotaUpdate returns a boolean if a field has been set. + +### GetUsers + +`func (o *BaseVirtualFolder) GetUsers() []string` + +GetUsers returns the Users field if non-nil, zero value otherwise. + +### GetUsersOk + +`func (o *BaseVirtualFolder) GetUsersOk() (*[]string, bool)` + +GetUsersOk returns a tuple with the Users field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsers + +`func (o *BaseVirtualFolder) SetUsers(v []string)` + +SetUsers sets Users field to given value. + +### HasUsers + +`func (o *BaseVirtualFolder) HasUsers() bool` + +HasUsers returns a boolean if a field has been set. + +### GetFilesystem + +`func (o *BaseVirtualFolder) GetFilesystem() FilesystemConfig` + +GetFilesystem returns the Filesystem field if non-nil, zero value otherwise. + +### GetFilesystemOk + +`func (o *BaseVirtualFolder) GetFilesystemOk() (*FilesystemConfig, bool)` + +GetFilesystemOk returns a tuple with the Filesystem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilesystem + +`func (o *BaseVirtualFolder) SetFilesystem(v FilesystemConfig)` + +SetFilesystem sets Filesystem field to given value. + +### HasFilesystem + +`func (o *BaseVirtualFolder) HasFilesystem() bool` + +HasFilesystem returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/ConnectionStatus.md b/server/common/sftpgo/v2/openapi/docs/ConnectionStatus.md new file mode 100644 index 00000000..5aff26c2 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/ConnectionStatus.md @@ -0,0 +1,264 @@ +# ConnectionStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Username** | Pointer to **string** | connected username | [optional] +**ConnectionId** | Pointer to **string** | unique connection identifier | [optional] +**ClientVersion** | Pointer to **string** | client version | [optional] +**RemoteAddress** | Pointer to **string** | Remote address for the connected client | [optional] +**ConnectionTime** | Pointer to **int64** | connection time as unix timestamp in milliseconds | [optional] +**Command** | Pointer to **string** | Last SSH/FTP command or WebDAV method | [optional] +**LastActivity** | Pointer to **int64** | last client activity as unix timestamp in milliseconds | [optional] +**Protocol** | Pointer to **string** | | [optional] +**ActiveTransfers** | Pointer to [**[]Transfer**](Transfer.md) | | [optional] + +## Methods + +### NewConnectionStatus + +`func NewConnectionStatus() *ConnectionStatus` + +NewConnectionStatus instantiates a new ConnectionStatus object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewConnectionStatusWithDefaults + +`func NewConnectionStatusWithDefaults() *ConnectionStatus` + +NewConnectionStatusWithDefaults instantiates a new ConnectionStatus object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetUsername + +`func (o *ConnectionStatus) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *ConnectionStatus) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *ConnectionStatus) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *ConnectionStatus) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetConnectionId + +`func (o *ConnectionStatus) GetConnectionId() string` + +GetConnectionId returns the ConnectionId field if non-nil, zero value otherwise. + +### GetConnectionIdOk + +`func (o *ConnectionStatus) GetConnectionIdOk() (*string, bool)` + +GetConnectionIdOk returns a tuple with the ConnectionId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConnectionId + +`func (o *ConnectionStatus) SetConnectionId(v string)` + +SetConnectionId sets ConnectionId field to given value. + +### HasConnectionId + +`func (o *ConnectionStatus) HasConnectionId() bool` + +HasConnectionId returns a boolean if a field has been set. + +### GetClientVersion + +`func (o *ConnectionStatus) GetClientVersion() string` + +GetClientVersion returns the ClientVersion field if non-nil, zero value otherwise. + +### GetClientVersionOk + +`func (o *ConnectionStatus) GetClientVersionOk() (*string, bool)` + +GetClientVersionOk returns a tuple with the ClientVersion field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClientVersion + +`func (o *ConnectionStatus) SetClientVersion(v string)` + +SetClientVersion sets ClientVersion field to given value. + +### HasClientVersion + +`func (o *ConnectionStatus) HasClientVersion() bool` + +HasClientVersion returns a boolean if a field has been set. + +### GetRemoteAddress + +`func (o *ConnectionStatus) GetRemoteAddress() string` + +GetRemoteAddress returns the RemoteAddress field if non-nil, zero value otherwise. + +### GetRemoteAddressOk + +`func (o *ConnectionStatus) GetRemoteAddressOk() (*string, bool)` + +GetRemoteAddressOk returns a tuple with the RemoteAddress field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRemoteAddress + +`func (o *ConnectionStatus) SetRemoteAddress(v string)` + +SetRemoteAddress sets RemoteAddress field to given value. + +### HasRemoteAddress + +`func (o *ConnectionStatus) HasRemoteAddress() bool` + +HasRemoteAddress returns a boolean if a field has been set. + +### GetConnectionTime + +`func (o *ConnectionStatus) GetConnectionTime() int64` + +GetConnectionTime returns the ConnectionTime field if non-nil, zero value otherwise. + +### GetConnectionTimeOk + +`func (o *ConnectionStatus) GetConnectionTimeOk() (*int64, bool)` + +GetConnectionTimeOk returns a tuple with the ConnectionTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConnectionTime + +`func (o *ConnectionStatus) SetConnectionTime(v int64)` + +SetConnectionTime sets ConnectionTime field to given value. + +### HasConnectionTime + +`func (o *ConnectionStatus) HasConnectionTime() bool` + +HasConnectionTime returns a boolean if a field has been set. + +### GetCommand + +`func (o *ConnectionStatus) GetCommand() string` + +GetCommand returns the Command field if non-nil, zero value otherwise. + +### GetCommandOk + +`func (o *ConnectionStatus) GetCommandOk() (*string, bool)` + +GetCommandOk returns a tuple with the Command field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCommand + +`func (o *ConnectionStatus) SetCommand(v string)` + +SetCommand sets Command field to given value. + +### HasCommand + +`func (o *ConnectionStatus) HasCommand() bool` + +HasCommand returns a boolean if a field has been set. + +### GetLastActivity + +`func (o *ConnectionStatus) GetLastActivity() int64` + +GetLastActivity returns the LastActivity field if non-nil, zero value otherwise. + +### GetLastActivityOk + +`func (o *ConnectionStatus) GetLastActivityOk() (*int64, bool)` + +GetLastActivityOk returns a tuple with the LastActivity field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastActivity + +`func (o *ConnectionStatus) SetLastActivity(v int64)` + +SetLastActivity sets LastActivity field to given value. + +### HasLastActivity + +`func (o *ConnectionStatus) HasLastActivity() bool` + +HasLastActivity returns a boolean if a field has been set. + +### GetProtocol + +`func (o *ConnectionStatus) GetProtocol() string` + +GetProtocol returns the Protocol field if non-nil, zero value otherwise. + +### GetProtocolOk + +`func (o *ConnectionStatus) GetProtocolOk() (*string, bool)` + +GetProtocolOk returns a tuple with the Protocol field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProtocol + +`func (o *ConnectionStatus) SetProtocol(v string)` + +SetProtocol sets Protocol field to given value. + +### HasProtocol + +`func (o *ConnectionStatus) HasProtocol() bool` + +HasProtocol returns a boolean if a field has been set. + +### GetActiveTransfers + +`func (o *ConnectionStatus) GetActiveTransfers() []Transfer` + +GetActiveTransfers returns the ActiveTransfers field if non-nil, zero value otherwise. + +### GetActiveTransfersOk + +`func (o *ConnectionStatus) GetActiveTransfersOk() (*[]Transfer, bool)` + +GetActiveTransfersOk returns a tuple with the ActiveTransfers field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetActiveTransfers + +`func (o *ConnectionStatus) SetActiveTransfers(v []Transfer)` + +SetActiveTransfers sets ActiveTransfers field to given value. + +### HasActiveTransfers + +`func (o *ConnectionStatus) HasActiveTransfers() bool` + +HasActiveTransfers returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/ConnectionsApi.md b/server/common/sftpgo/v2/openapi/docs/ConnectionsApi.md new file mode 100644 index 00000000..760599bb --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/ConnectionsApi.md @@ -0,0 +1,141 @@ +# \ConnectionsApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CloseConnection**](ConnectionsApi.md#CloseConnection) | **Delete** /connections/{connectionID} | Close connection +[**GetConnections**](ConnectionsApi.md#GetConnections) | **Get** /connections | Get connections details + + + +## CloseConnection + +> ApiResponse CloseConnection(ctx, connectionID).Execute() + +Close connection + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + connectionID := "connectionID_example" // string | ID of the connection to close + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ConnectionsApi.CloseConnection(context.Background(), connectionID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ConnectionsApi.CloseConnection``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CloseConnection`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `ConnectionsApi.CloseConnection`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**connectionID** | **string** | ID of the connection to close | + +### Other Parameters + +Other parameters are passed through a pointer to a apiCloseConnectionRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetConnections + +> []ConnectionStatus GetConnections(ctx).Execute() + +Get connections details + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ConnectionsApi.GetConnections(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ConnectionsApi.GetConnections``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetConnections`: []ConnectionStatus + fmt.Fprintf(os.Stdout, "Response from `ConnectionsApi.GetConnections`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetConnectionsRequest struct via the builder pattern + + +### Return type + +[**[]ConnectionStatus**](ConnectionStatus.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/CryptFsConfig.md b/server/common/sftpgo/v2/openapi/docs/CryptFsConfig.md new file mode 100644 index 00000000..0382dd62 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/CryptFsConfig.md @@ -0,0 +1,56 @@ +# CryptFsConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Passphrase** | Pointer to [**Secret**](Secret.md) | | [optional] + +## Methods + +### NewCryptFsConfig + +`func NewCryptFsConfig() *CryptFsConfig` + +NewCryptFsConfig instantiates a new CryptFsConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewCryptFsConfigWithDefaults + +`func NewCryptFsConfigWithDefaults() *CryptFsConfig` + +NewCryptFsConfigWithDefaults instantiates a new CryptFsConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetPassphrase + +`func (o *CryptFsConfig) GetPassphrase() Secret` + +GetPassphrase returns the Passphrase field if non-nil, zero value otherwise. + +### GetPassphraseOk + +`func (o *CryptFsConfig) GetPassphraseOk() (*Secret, bool)` + +GetPassphraseOk returns a tuple with the Passphrase field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassphrase + +`func (o *CryptFsConfig) SetPassphrase(v Secret)` + +SetPassphrase sets Passphrase field to given value. + +### HasPassphrase + +`func (o *CryptFsConfig) HasPassphrase() bool` + +HasPassphrase returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/DataProviderStatus.md b/server/common/sftpgo/v2/openapi/docs/DataProviderStatus.md new file mode 100644 index 00000000..278f1582 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/DataProviderStatus.md @@ -0,0 +1,108 @@ +# DataProviderStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**IsActive** | Pointer to **bool** | | [optional] +**Driver** | Pointer to **string** | | [optional] +**Error** | Pointer to **string** | | [optional] + +## Methods + +### NewDataProviderStatus + +`func NewDataProviderStatus() *DataProviderStatus` + +NewDataProviderStatus instantiates a new DataProviderStatus object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewDataProviderStatusWithDefaults + +`func NewDataProviderStatusWithDefaults() *DataProviderStatus` + +NewDataProviderStatusWithDefaults instantiates a new DataProviderStatus object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIsActive + +`func (o *DataProviderStatus) GetIsActive() bool` + +GetIsActive returns the IsActive field if non-nil, zero value otherwise. + +### GetIsActiveOk + +`func (o *DataProviderStatus) GetIsActiveOk() (*bool, bool)` + +GetIsActiveOk returns a tuple with the IsActive field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsActive + +`func (o *DataProviderStatus) SetIsActive(v bool)` + +SetIsActive sets IsActive field to given value. + +### HasIsActive + +`func (o *DataProviderStatus) HasIsActive() bool` + +HasIsActive returns a boolean if a field has been set. + +### GetDriver + +`func (o *DataProviderStatus) GetDriver() string` + +GetDriver returns the Driver field if non-nil, zero value otherwise. + +### GetDriverOk + +`func (o *DataProviderStatus) GetDriverOk() (*string, bool)` + +GetDriverOk returns a tuple with the Driver field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDriver + +`func (o *DataProviderStatus) SetDriver(v string)` + +SetDriver sets Driver field to given value. + +### HasDriver + +`func (o *DataProviderStatus) HasDriver() bool` + +HasDriver returns a boolean if a field has been set. + +### GetError + +`func (o *DataProviderStatus) GetError() string` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *DataProviderStatus) GetErrorOk() (*string, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *DataProviderStatus) SetError(v string)` + +SetError sets Error field to given value. + +### HasError + +`func (o *DataProviderStatus) HasError() bool` + +HasError returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/DataRetentionApi.md b/server/common/sftpgo/v2/openapi/docs/DataRetentionApi.md new file mode 100644 index 00000000..1823e1be --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/DataRetentionApi.md @@ -0,0 +1,145 @@ +# \DataRetentionApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**GetUsersRetentionChecks**](DataRetentionApi.md#GetUsersRetentionChecks) | **Get** /retention/users/checks | Get retention checks +[**StartUserRetentionCheck**](DataRetentionApi.md#StartUserRetentionCheck) | **Post** /retention/users/{username}/check | Start a retention check + + + +## GetUsersRetentionChecks + +> []RetentionCheck GetUsersRetentionChecks(ctx).Execute() + +Get retention checks + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DataRetentionApi.GetUsersRetentionChecks(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DataRetentionApi.GetUsersRetentionChecks``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUsersRetentionChecks`: []RetentionCheck + fmt.Fprintf(os.Stdout, "Response from `DataRetentionApi.GetUsersRetentionChecks`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUsersRetentionChecksRequest struct via the builder pattern + + +### Return type + +[**[]RetentionCheck**](RetentionCheck.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## StartUserRetentionCheck + +> ApiResponse StartUserRetentionCheck(ctx, username).FolderRetention(folderRetention).Notifications(notifications).Execute() + +Start a retention check + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the username + folderRetention := []openapiclient.FolderRetention{*openapiclient.NewFolderRetention()} // []FolderRetention | Defines virtual paths to check and their retention time in hours + notifications := []openapiclient.RetentionCheckNotification{openapiclient.RetentionCheckNotification("Hook")} // []RetentionCheckNotification | specify how to notify results (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DataRetentionApi.StartUserRetentionCheck(context.Background(), username).FolderRetention(folderRetention).Notifications(notifications).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DataRetentionApi.StartUserRetentionCheck``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `StartUserRetentionCheck`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `DataRetentionApi.StartUserRetentionCheck`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiStartUserRetentionCheckRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **folderRetention** | [**[]FolderRetention**](FolderRetention.md) | Defines virtual paths to check and their retention time in hours | + **notifications** | [**[]RetentionCheckNotification**](RetentionCheckNotification.md) | specify how to notify results | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/DataTransferLimit.md b/server/common/sftpgo/v2/openapi/docs/DataTransferLimit.md new file mode 100644 index 00000000..ea23f477 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/DataTransferLimit.md @@ -0,0 +1,134 @@ +# DataTransferLimit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Sources** | Pointer to **[]string** | Source networks in CIDR notation as defined in RFC 4632 and RFC 4291 for example `192.0.2.0/24` or `2001:db8::/32`. The limit applies if the defined networks contain the client IP | [optional] +**UploadDataTransfer** | Pointer to **int32** | Maximum data transfer allowed for uploads as MB. 0 means no limit | [optional] +**DownloadDataTransfer** | Pointer to **int32** | Maximum data transfer allowed for downloads as MB. 0 means no limit | [optional] +**TotalDataTransfer** | Pointer to **int32** | Maximum total data transfer as MB. 0 means unlimited. You can set a total data transfer instead of the individual values for uploads and downloads | [optional] + +## Methods + +### NewDataTransferLimit + +`func NewDataTransferLimit() *DataTransferLimit` + +NewDataTransferLimit instantiates a new DataTransferLimit object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewDataTransferLimitWithDefaults + +`func NewDataTransferLimitWithDefaults() *DataTransferLimit` + +NewDataTransferLimitWithDefaults instantiates a new DataTransferLimit object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetSources + +`func (o *DataTransferLimit) GetSources() []string` + +GetSources returns the Sources field if non-nil, zero value otherwise. + +### GetSourcesOk + +`func (o *DataTransferLimit) GetSourcesOk() (*[]string, bool)` + +GetSourcesOk returns a tuple with the Sources field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSources + +`func (o *DataTransferLimit) SetSources(v []string)` + +SetSources sets Sources field to given value. + +### HasSources + +`func (o *DataTransferLimit) HasSources() bool` + +HasSources returns a boolean if a field has been set. + +### GetUploadDataTransfer + +`func (o *DataTransferLimit) GetUploadDataTransfer() int32` + +GetUploadDataTransfer returns the UploadDataTransfer field if non-nil, zero value otherwise. + +### GetUploadDataTransferOk + +`func (o *DataTransferLimit) GetUploadDataTransferOk() (*int32, bool)` + +GetUploadDataTransferOk returns a tuple with the UploadDataTransfer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUploadDataTransfer + +`func (o *DataTransferLimit) SetUploadDataTransfer(v int32)` + +SetUploadDataTransfer sets UploadDataTransfer field to given value. + +### HasUploadDataTransfer + +`func (o *DataTransferLimit) HasUploadDataTransfer() bool` + +HasUploadDataTransfer returns a boolean if a field has been set. + +### GetDownloadDataTransfer + +`func (o *DataTransferLimit) GetDownloadDataTransfer() int32` + +GetDownloadDataTransfer returns the DownloadDataTransfer field if non-nil, zero value otherwise. + +### GetDownloadDataTransferOk + +`func (o *DataTransferLimit) GetDownloadDataTransferOk() (*int32, bool)` + +GetDownloadDataTransferOk returns a tuple with the DownloadDataTransfer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDownloadDataTransfer + +`func (o *DataTransferLimit) SetDownloadDataTransfer(v int32)` + +SetDownloadDataTransfer sets DownloadDataTransfer field to given value. + +### HasDownloadDataTransfer + +`func (o *DataTransferLimit) HasDownloadDataTransfer() bool` + +HasDownloadDataTransfer returns a boolean if a field has been set. + +### GetTotalDataTransfer + +`func (o *DataTransferLimit) GetTotalDataTransfer() int32` + +GetTotalDataTransfer returns the TotalDataTransfer field if non-nil, zero value otherwise. + +### GetTotalDataTransferOk + +`func (o *DataTransferLimit) GetTotalDataTransferOk() (*int32, bool)` + +GetTotalDataTransferOk returns a tuple with the TotalDataTransfer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotalDataTransfer + +`func (o *DataTransferLimit) SetTotalDataTransfer(v int32)` + +SetTotalDataTransfer sets TotalDataTransfer field to given value. + +### HasTotalDataTransfer + +`func (o *DataTransferLimit) HasTotalDataTransfer() bool` + +HasTotalDataTransfer returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/DefenderApi.md b/server/common/sftpgo/v2/openapi/docs/DefenderApi.md new file mode 100644 index 00000000..33d8cf2c --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/DefenderApi.md @@ -0,0 +1,413 @@ +# \DefenderApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**DeleteDefenderHostById**](DefenderApi.md#DeleteDefenderHostById) | **Delete** /defender/hosts/{id} | Removes a host from the defender lists +[**GetBanTime**](DefenderApi.md#GetBanTime) | **Get** /defender/bantime | Get ban time +[**GetDefenderHostById**](DefenderApi.md#GetDefenderHostById) | **Get** /defender/hosts/{id} | Get host by id +[**GetDefenderHosts**](DefenderApi.md#GetDefenderHosts) | **Get** /defender/hosts | Get hosts +[**GetScore**](DefenderApi.md#GetScore) | **Get** /defender/score | Get score +[**UnbanHost**](DefenderApi.md#UnbanHost) | **Post** /defender/unban | Unban + + + +## DeleteDefenderHostById + +> ApiResponse DeleteDefenderHostById(ctx, id).Execute() + +Removes a host from the defender lists + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | host id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefenderApi.DeleteDefenderHostById(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefenderApi.DeleteDefenderHostById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DeleteDefenderHostById`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `DefenderApi.DeleteDefenderHostById`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | host id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteDefenderHostByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetBanTime + +> BanStatus GetBanTime(ctx).Ip(ip).Execute() + +Get ban time + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + ip := "ip_example" // string | IPv4/IPv6 address + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefenderApi.GetBanTime(context.Background()).Ip(ip).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefenderApi.GetBanTime``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetBanTime`: BanStatus + fmt.Fprintf(os.Stdout, "Response from `DefenderApi.GetBanTime`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetBanTimeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ip** | **string** | IPv4/IPv6 address | + +### Return type + +[**BanStatus**](BanStatus.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetDefenderHostById + +> DefenderEntry GetDefenderHostById(ctx, id).Execute() + +Get host by id + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | host id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefenderApi.GetDefenderHostById(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefenderApi.GetDefenderHostById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetDefenderHostById`: DefenderEntry + fmt.Fprintf(os.Stdout, "Response from `DefenderApi.GetDefenderHostById`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | host id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetDefenderHostByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**DefenderEntry**](DefenderEntry.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetDefenderHosts + +> []DefenderEntry GetDefenderHosts(ctx).Execute() + +Get hosts + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefenderApi.GetDefenderHosts(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefenderApi.GetDefenderHosts``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetDefenderHosts`: []DefenderEntry + fmt.Fprintf(os.Stdout, "Response from `DefenderApi.GetDefenderHosts`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetDefenderHostsRequest struct via the builder pattern + + +### Return type + +[**[]DefenderEntry**](DefenderEntry.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetScore + +> ScoreStatus GetScore(ctx).Ip(ip).Execute() + +Get score + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + ip := "ip_example" // string | IPv4/IPv6 address + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefenderApi.GetScore(context.Background()).Ip(ip).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefenderApi.GetScore``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetScore`: ScoreStatus + fmt.Fprintf(os.Stdout, "Response from `DefenderApi.GetScore`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetScoreRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ip** | **string** | IPv4/IPv6 address | + +### Return type + +[**ScoreStatus**](ScoreStatus.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UnbanHost + +> ApiResponse UnbanHost(ctx).InlineObject3(inlineObject3).Execute() + +Unban + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + inlineObject3 := *openapiclient.NewInlineObject3() // InlineObject3 | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefenderApi.UnbanHost(context.Background()).InlineObject3(inlineObject3).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefenderApi.UnbanHost``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UnbanHost`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `DefenderApi.UnbanHost`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiUnbanHostRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **inlineObject3** | [**InlineObject3**](InlineObject3.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/DefenderEntry.md b/server/common/sftpgo/v2/openapi/docs/DefenderEntry.md new file mode 100644 index 00000000..066fe992 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/DefenderEntry.md @@ -0,0 +1,134 @@ +# DefenderEntry + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] +**Ip** | Pointer to **string** | | [optional] +**Score** | Pointer to **int32** | the score increases whenever a violation is detected, such as an attempt to log in using an incorrect password or invalid username. If the score exceeds the configured threshold, the IP is banned. Omitted for banned IPs | [optional] +**BanTime** | Pointer to **time.Time** | date time until the IP is banned. For already banned hosts, the ban time is increased each time a new violation is detected. Omitted if the IP is not banned | [optional] + +## Methods + +### NewDefenderEntry + +`func NewDefenderEntry() *DefenderEntry` + +NewDefenderEntry instantiates a new DefenderEntry object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewDefenderEntryWithDefaults + +`func NewDefenderEntryWithDefaults() *DefenderEntry` + +NewDefenderEntryWithDefaults instantiates a new DefenderEntry object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *DefenderEntry) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *DefenderEntry) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *DefenderEntry) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *DefenderEntry) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetIp + +`func (o *DefenderEntry) GetIp() string` + +GetIp returns the Ip field if non-nil, zero value otherwise. + +### GetIpOk + +`func (o *DefenderEntry) GetIpOk() (*string, bool)` + +GetIpOk returns a tuple with the Ip field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIp + +`func (o *DefenderEntry) SetIp(v string)` + +SetIp sets Ip field to given value. + +### HasIp + +`func (o *DefenderEntry) HasIp() bool` + +HasIp returns a boolean if a field has been set. + +### GetScore + +`func (o *DefenderEntry) GetScore() int32` + +GetScore returns the Score field if non-nil, zero value otherwise. + +### GetScoreOk + +`func (o *DefenderEntry) GetScoreOk() (*int32, bool)` + +GetScoreOk returns a tuple with the Score field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetScore + +`func (o *DefenderEntry) SetScore(v int32)` + +SetScore sets Score field to given value. + +### HasScore + +`func (o *DefenderEntry) HasScore() bool` + +HasScore returns a boolean if a field has been set. + +### GetBanTime + +`func (o *DefenderEntry) GetBanTime() time.Time` + +GetBanTime returns the BanTime field if non-nil, zero value otherwise. + +### GetBanTimeOk + +`func (o *DefenderEntry) GetBanTimeOk() (*time.Time, bool)` + +GetBanTimeOk returns a tuple with the BanTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBanTime + +`func (o *DefenderEntry) SetBanTime(v time.Time)` + +SetBanTime sets BanTime field to given value. + +### HasBanTime + +`func (o *DefenderEntry) HasBanTime() bool` + +HasBanTime returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/DirEntry.md b/server/common/sftpgo/v2/openapi/docs/DirEntry.md new file mode 100644 index 00000000..98a333c0 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/DirEntry.md @@ -0,0 +1,134 @@ +# DirEntry + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | name of the file (or subdirectory) described by the entry. This name is the final element of the path (the base name), not the entire path | [optional] +**Size** | Pointer to **int64** | file size, omitted for folders and non regular files | [optional] +**Mode** | Pointer to **int32** | File mode and permission bits. More details here: https://golang.org/pkg/io/fs/#FileMode. Let's see some examples: - for a directory mode&2147483648 != 0 - for a symlink mode&134217728 != 0 - for a regular file mode&2401763328 == 0 | [optional] +**LastModified** | Pointer to **time.Time** | | [optional] + +## Methods + +### NewDirEntry + +`func NewDirEntry() *DirEntry` + +NewDirEntry instantiates a new DirEntry object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewDirEntryWithDefaults + +`func NewDirEntryWithDefaults() *DirEntry` + +NewDirEntryWithDefaults instantiates a new DirEntry object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *DirEntry) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *DirEntry) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *DirEntry) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *DirEntry) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetSize + +`func (o *DirEntry) GetSize() int64` + +GetSize returns the Size field if non-nil, zero value otherwise. + +### GetSizeOk + +`func (o *DirEntry) GetSizeOk() (*int64, bool)` + +GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSize + +`func (o *DirEntry) SetSize(v int64)` + +SetSize sets Size field to given value. + +### HasSize + +`func (o *DirEntry) HasSize() bool` + +HasSize returns a boolean if a field has been set. + +### GetMode + +`func (o *DirEntry) GetMode() int32` + +GetMode returns the Mode field if non-nil, zero value otherwise. + +### GetModeOk + +`func (o *DirEntry) GetModeOk() (*int32, bool)` + +GetModeOk returns a tuple with the Mode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMode + +`func (o *DirEntry) SetMode(v int32)` + +SetMode sets Mode field to given value. + +### HasMode + +`func (o *DirEntry) HasMode() bool` + +HasMode returns a boolean if a field has been set. + +### GetLastModified + +`func (o *DirEntry) GetLastModified() time.Time` + +GetLastModified returns the LastModified field if non-nil, zero value otherwise. + +### GetLastModifiedOk + +`func (o *DirEntry) GetLastModifiedOk() (*time.Time, bool)` + +GetLastModifiedOk returns a tuple with the LastModified field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastModified + +`func (o *DirEntry) SetLastModified(v time.Time)` + +SetLastModified sets LastModified field to given value. + +### HasLastModified + +`func (o *DirEntry) HasLastModified() bool` + +HasLastModified returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/EventProtocols.md b/server/common/sftpgo/v2/openapi/docs/EventProtocols.md new file mode 100644 index 00000000..94c7c6e0 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/EventProtocols.md @@ -0,0 +1,23 @@ +# EventProtocols + +## Enum + + +* `SSH` (value: `"SSH"`) + +* `SFTP` (value: `"SFTP"`) + +* `SCP` (value: `"SCP"`) + +* `FTP` (value: `"FTP"`) + +* `DAV` (value: `"DAV"`) + +* `HTTP` (value: `"HTTP"`) + +* `DATA_RETENTION` (value: `"DataRetention"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/EventsApi.md b/server/common/sftpgo/v2/openapi/docs/EventsApi.md new file mode 100644 index 00000000..419e165c --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/EventsApi.md @@ -0,0 +1,190 @@ +# \EventsApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**GetFsEvents**](EventsApi.md#GetFsEvents) | **Get** /events/fs | Get filesystem events +[**GetProviderEvents**](EventsApi.md#GetProviderEvents) | **Get** /events/provider | Get provider events + + + +## GetFsEvents + +> []FsEvent GetFsEvents(ctx).StartTimestamp(startTimestamp).EndTimestamp(endTimestamp).Actions(actions).Username(username).Ip(ip).SshCmd(sshCmd).FsProvider(fsProvider).Bucket(bucket).Endpoint(endpoint).Protocols(protocols).Statuses(statuses).InstanceIds(instanceIds).ExcludeIds(excludeIds).Limit(limit).Order(order).Execute() + +Get filesystem events + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + startTimestamp := int64(789) // int64 | the event timestamp, unix timestamp in nanoseconds, must be greater than or equal to the specified one. 0 or missing means omit this filter (optional) (default to 0) + endTimestamp := int64(789) // int64 | the event timestamp, unix timestamp in nanoseconds, must be less than or equal to the specified one. 0 or missing means omit this filter (optional) (default to 0) + actions := []openapiclient.FsEventAction{openapiclient.FsEventAction("download")} // []FsEventAction | the event action must be included among those specified. Empty or missing means omit this filter. Actions must be specified comma separated (optional) + username := "username_example" // string | the event username must be the same as the one specified. Empty or missing means omit this filter (optional) + ip := "ip_example" // string | the event IP must be the same as the one specified. Empty or missing means omit this filter (optional) + sshCmd := "sshCmd_example" // string | the event SSH command must be the same as the one specified. Empty or missing means omit this filter (optional) + fsProvider := openapiclient.FsProviders(0) // FsProviders | the event filesystem provider must be the same as the one specified. Empty or missing means omit this filter (optional) + bucket := "bucket_example" // string | the bucket must be the same as the one specified. Empty or missing means omit this filter (optional) + endpoint := "endpoint_example" // string | the endpoint must be the same as the one specified. Empty or missing means omit this filter (optional) + protocols := []openapiclient.EventProtocols{openapiclient.EventProtocols("SSH")} // []EventProtocols | the event protocol must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated (optional) + statuses := []openapiclient.FsEventStatus{openapiclient.FsEventStatus(1)} // []FsEventStatus | the event status must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated (optional) + instanceIds := []string{"Inner_example"} // []string | the event instance id must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated (optional) + excludeIds := []string{"Inner_example"} // []string | the event id must not be included among those specified. This is useful for cursor based pagination. Empty or missing means omit this filter. Values must be specified comma separated (optional) + limit := int32(56) // int32 | The maximum number of items to return. Max value is 500, default is 100 (optional) (default to 100) + order := "DESC" // string | Ordering events by timestamp. Default DESC (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.EventsApi.GetFsEvents(context.Background()).StartTimestamp(startTimestamp).EndTimestamp(endTimestamp).Actions(actions).Username(username).Ip(ip).SshCmd(sshCmd).FsProvider(fsProvider).Bucket(bucket).Endpoint(endpoint).Protocols(protocols).Statuses(statuses).InstanceIds(instanceIds).ExcludeIds(excludeIds).Limit(limit).Order(order).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `EventsApi.GetFsEvents``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetFsEvents`: []FsEvent + fmt.Fprintf(os.Stdout, "Response from `EventsApi.GetFsEvents`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetFsEventsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **startTimestamp** | **int64** | the event timestamp, unix timestamp in nanoseconds, must be greater than or equal to the specified one. 0 or missing means omit this filter | [default to 0] + **endTimestamp** | **int64** | the event timestamp, unix timestamp in nanoseconds, must be less than or equal to the specified one. 0 or missing means omit this filter | [default to 0] + **actions** | [**[]FsEventAction**](FsEventAction.md) | the event action must be included among those specified. Empty or missing means omit this filter. Actions must be specified comma separated | + **username** | **string** | the event username must be the same as the one specified. Empty or missing means omit this filter | + **ip** | **string** | the event IP must be the same as the one specified. Empty or missing means omit this filter | + **sshCmd** | **string** | the event SSH command must be the same as the one specified. Empty or missing means omit this filter | + **fsProvider** | [**FsProviders**](FsProviders.md) | the event filesystem provider must be the same as the one specified. Empty or missing means omit this filter | + **bucket** | **string** | the bucket must be the same as the one specified. Empty or missing means omit this filter | + **endpoint** | **string** | the endpoint must be the same as the one specified. Empty or missing means omit this filter | + **protocols** | [**[]EventProtocols**](EventProtocols.md) | the event protocol must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated | + **statuses** | [**[]FsEventStatus**](FsEventStatus.md) | the event status must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated | + **instanceIds** | **[]string** | the event instance id must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated | + **excludeIds** | **[]string** | the event id must not be included among those specified. This is useful for cursor based pagination. Empty or missing means omit this filter. Values must be specified comma separated | + **limit** | **int32** | The maximum number of items to return. Max value is 500, default is 100 | [default to 100] + **order** | **string** | Ordering events by timestamp. Default DESC | + +### Return type + +[**[]FsEvent**](FsEvent.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetProviderEvents + +> []ProviderEvent GetProviderEvents(ctx).StartTimestamp(startTimestamp).EndTimestamp(endTimestamp).Actions(actions).Username(username).Ip(ip).ObjectName(objectName).ObjectTypes(objectTypes).InstanceIds(instanceIds).ExcludeIds(excludeIds).Limit(limit).Order(order).Execute() + +Get provider events + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + startTimestamp := int64(789) // int64 | the event timestamp, unix timestamp in nanoseconds, must be greater than or equal to the specified one. 0 or missing means omit this filter (optional) (default to 0) + endTimestamp := int64(789) // int64 | the event timestamp, unix timestamp in nanoseconds, must be less than or equal to the specified one. 0 or missing means omit this filter (optional) (default to 0) + actions := []openapiclient.ProviderEventAction{openapiclient.ProviderEventAction("add")} // []ProviderEventAction | the event action must be included among those specified. Empty or missing means omit this filter. Actions must be specified comma separated (optional) + username := "username_example" // string | the event username must be the same as the one specified. Empty or missing means omit this filter (optional) + ip := "ip_example" // string | the event IP must be the same as the one specified. Empty or missing means omit this filter (optional) + objectName := "objectName_example" // string | the event object name must be the same as the one specified. Empty or missing means omit this filter (optional) + objectTypes := []openapiclient.ProviderEventObjectType{openapiclient.ProviderEventObjectType("user")} // []ProviderEventObjectType | the event object type must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated (optional) + instanceIds := []string{"Inner_example"} // []string | the event instance id must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated (optional) + excludeIds := []string{"Inner_example"} // []string | the event id must not be included among those specified. This is useful for cursor based pagination. Empty or missing means omit this filter. Values must be specified comma separated (optional) + limit := int32(56) // int32 | The maximum number of items to return. Max value is 500, default is 100 (optional) (default to 100) + order := "DESC" // string | Ordering events by timestamp. Default DESC (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.EventsApi.GetProviderEvents(context.Background()).StartTimestamp(startTimestamp).EndTimestamp(endTimestamp).Actions(actions).Username(username).Ip(ip).ObjectName(objectName).ObjectTypes(objectTypes).InstanceIds(instanceIds).ExcludeIds(excludeIds).Limit(limit).Order(order).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `EventsApi.GetProviderEvents``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetProviderEvents`: []ProviderEvent + fmt.Fprintf(os.Stdout, "Response from `EventsApi.GetProviderEvents`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetProviderEventsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **startTimestamp** | **int64** | the event timestamp, unix timestamp in nanoseconds, must be greater than or equal to the specified one. 0 or missing means omit this filter | [default to 0] + **endTimestamp** | **int64** | the event timestamp, unix timestamp in nanoseconds, must be less than or equal to the specified one. 0 or missing means omit this filter | [default to 0] + **actions** | [**[]ProviderEventAction**](ProviderEventAction.md) | the event action must be included among those specified. Empty or missing means omit this filter. Actions must be specified comma separated | + **username** | **string** | the event username must be the same as the one specified. Empty or missing means omit this filter | + **ip** | **string** | the event IP must be the same as the one specified. Empty or missing means omit this filter | + **objectName** | **string** | the event object name must be the same as the one specified. Empty or missing means omit this filter | + **objectTypes** | [**[]ProviderEventObjectType**](ProviderEventObjectType.md) | the event object type must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated | + **instanceIds** | **[]string** | the event instance id must be included among those specified. Empty or missing means omit this filter. Values must be specified comma separated | + **excludeIds** | **[]string** | the event id must not be included among those specified. This is useful for cursor based pagination. Empty or missing means omit this filter. Values must be specified comma separated | + **limit** | **int32** | The maximum number of items to return. Max value is 500, default is 100 | [default to 100] + **order** | **string** | Ordering events by timestamp. Default DESC | + +### Return type + +[**[]ProviderEvent**](ProviderEvent.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/FTPDBinding.md b/server/common/sftpgo/v2/openapi/docs/FTPDBinding.md new file mode 100644 index 00000000..c24e4eca --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/FTPDBinding.md @@ -0,0 +1,186 @@ +# FTPDBinding + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Address** | Pointer to **string** | TCP address the server listen on | [optional] +**Port** | Pointer to **int32** | the port used for serving requests | [optional] +**ApplyProxyConfig** | Pointer to **bool** | apply the proxy configuration, if any | [optional] +**TlsMode** | Pointer to **int32** | TLS mode: * `0` - clear or explicit TLS * `1` - explicit TLS required * `2` - implicit TLS | [optional] +**ForcePassiveIp** | Pointer to **string** | External IP address to expose for passive connections | [optional] +**ClientAuthType** | Pointer to **int32** | 1 means that client certificate authentication is required in addition to FTP authentication | [optional] + +## Methods + +### NewFTPDBinding + +`func NewFTPDBinding() *FTPDBinding` + +NewFTPDBinding instantiates a new FTPDBinding object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFTPDBindingWithDefaults + +`func NewFTPDBindingWithDefaults() *FTPDBinding` + +NewFTPDBindingWithDefaults instantiates a new FTPDBinding object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAddress + +`func (o *FTPDBinding) GetAddress() string` + +GetAddress returns the Address field if non-nil, zero value otherwise. + +### GetAddressOk + +`func (o *FTPDBinding) GetAddressOk() (*string, bool)` + +GetAddressOk returns a tuple with the Address field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAddress + +`func (o *FTPDBinding) SetAddress(v string)` + +SetAddress sets Address field to given value. + +### HasAddress + +`func (o *FTPDBinding) HasAddress() bool` + +HasAddress returns a boolean if a field has been set. + +### GetPort + +`func (o *FTPDBinding) GetPort() int32` + +GetPort returns the Port field if non-nil, zero value otherwise. + +### GetPortOk + +`func (o *FTPDBinding) GetPortOk() (*int32, bool)` + +GetPortOk returns a tuple with the Port field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPort + +`func (o *FTPDBinding) SetPort(v int32)` + +SetPort sets Port field to given value. + +### HasPort + +`func (o *FTPDBinding) HasPort() bool` + +HasPort returns a boolean if a field has been set. + +### GetApplyProxyConfig + +`func (o *FTPDBinding) GetApplyProxyConfig() bool` + +GetApplyProxyConfig returns the ApplyProxyConfig field if non-nil, zero value otherwise. + +### GetApplyProxyConfigOk + +`func (o *FTPDBinding) GetApplyProxyConfigOk() (*bool, bool)` + +GetApplyProxyConfigOk returns a tuple with the ApplyProxyConfig field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetApplyProxyConfig + +`func (o *FTPDBinding) SetApplyProxyConfig(v bool)` + +SetApplyProxyConfig sets ApplyProxyConfig field to given value. + +### HasApplyProxyConfig + +`func (o *FTPDBinding) HasApplyProxyConfig() bool` + +HasApplyProxyConfig returns a boolean if a field has been set. + +### GetTlsMode + +`func (o *FTPDBinding) GetTlsMode() int32` + +GetTlsMode returns the TlsMode field if non-nil, zero value otherwise. + +### GetTlsModeOk + +`func (o *FTPDBinding) GetTlsModeOk() (*int32, bool)` + +GetTlsModeOk returns a tuple with the TlsMode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTlsMode + +`func (o *FTPDBinding) SetTlsMode(v int32)` + +SetTlsMode sets TlsMode field to given value. + +### HasTlsMode + +`func (o *FTPDBinding) HasTlsMode() bool` + +HasTlsMode returns a boolean if a field has been set. + +### GetForcePassiveIp + +`func (o *FTPDBinding) GetForcePassiveIp() string` + +GetForcePassiveIp returns the ForcePassiveIp field if non-nil, zero value otherwise. + +### GetForcePassiveIpOk + +`func (o *FTPDBinding) GetForcePassiveIpOk() (*string, bool)` + +GetForcePassiveIpOk returns a tuple with the ForcePassiveIp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetForcePassiveIp + +`func (o *FTPDBinding) SetForcePassiveIp(v string)` + +SetForcePassiveIp sets ForcePassiveIp field to given value. + +### HasForcePassiveIp + +`func (o *FTPDBinding) HasForcePassiveIp() bool` + +HasForcePassiveIp returns a boolean if a field has been set. + +### GetClientAuthType + +`func (o *FTPDBinding) GetClientAuthType() int32` + +GetClientAuthType returns the ClientAuthType field if non-nil, zero value otherwise. + +### GetClientAuthTypeOk + +`func (o *FTPDBinding) GetClientAuthTypeOk() (*int32, bool)` + +GetClientAuthTypeOk returns a tuple with the ClientAuthType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClientAuthType + +`func (o *FTPDBinding) SetClientAuthType(v int32)` + +SetClientAuthType sets ClientAuthType field to given value. + +### HasClientAuthType + +`func (o *FTPDBinding) HasClientAuthType() bool` + +HasClientAuthType returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/FTPPassivePortRange.md b/server/common/sftpgo/v2/openapi/docs/FTPPassivePortRange.md new file mode 100644 index 00000000..fc7444e1 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/FTPPassivePortRange.md @@ -0,0 +1,82 @@ +# FTPPassivePortRange + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Start** | Pointer to **int32** | | [optional] +**End** | Pointer to **int32** | | [optional] + +## Methods + +### NewFTPPassivePortRange + +`func NewFTPPassivePortRange() *FTPPassivePortRange` + +NewFTPPassivePortRange instantiates a new FTPPassivePortRange object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFTPPassivePortRangeWithDefaults + +`func NewFTPPassivePortRangeWithDefaults() *FTPPassivePortRange` + +NewFTPPassivePortRangeWithDefaults instantiates a new FTPPassivePortRange object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetStart + +`func (o *FTPPassivePortRange) GetStart() int32` + +GetStart returns the Start field if non-nil, zero value otherwise. + +### GetStartOk + +`func (o *FTPPassivePortRange) GetStartOk() (*int32, bool)` + +GetStartOk returns a tuple with the Start field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStart + +`func (o *FTPPassivePortRange) SetStart(v int32)` + +SetStart sets Start field to given value. + +### HasStart + +`func (o *FTPPassivePortRange) HasStart() bool` + +HasStart returns a boolean if a field has been set. + +### GetEnd + +`func (o *FTPPassivePortRange) GetEnd() int32` + +GetEnd returns the End field if non-nil, zero value otherwise. + +### GetEndOk + +`func (o *FTPPassivePortRange) GetEndOk() (*int32, bool)` + +GetEndOk returns a tuple with the End field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnd + +`func (o *FTPPassivePortRange) SetEnd(v int32)` + +SetEnd sets End field to given value. + +### HasEnd + +`func (o *FTPPassivePortRange) HasEnd() bool` + +HasEnd returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/FTPServiceStatus.md b/server/common/sftpgo/v2/openapi/docs/FTPServiceStatus.md new file mode 100644 index 00000000..ac8d4c3f --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/FTPServiceStatus.md @@ -0,0 +1,118 @@ +# FTPServiceStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**IsActive** | Pointer to **bool** | | [optional] +**Bindings** | Pointer to [**[]FTPDBinding**](FTPDBinding.md) | | [optional] +**PassivePortRange** | Pointer to [**FTPPassivePortRange**](FTPPassivePortRange.md) | | [optional] + +## Methods + +### NewFTPServiceStatus + +`func NewFTPServiceStatus() *FTPServiceStatus` + +NewFTPServiceStatus instantiates a new FTPServiceStatus object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFTPServiceStatusWithDefaults + +`func NewFTPServiceStatusWithDefaults() *FTPServiceStatus` + +NewFTPServiceStatusWithDefaults instantiates a new FTPServiceStatus object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIsActive + +`func (o *FTPServiceStatus) GetIsActive() bool` + +GetIsActive returns the IsActive field if non-nil, zero value otherwise. + +### GetIsActiveOk + +`func (o *FTPServiceStatus) GetIsActiveOk() (*bool, bool)` + +GetIsActiveOk returns a tuple with the IsActive field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsActive + +`func (o *FTPServiceStatus) SetIsActive(v bool)` + +SetIsActive sets IsActive field to given value. + +### HasIsActive + +`func (o *FTPServiceStatus) HasIsActive() bool` + +HasIsActive returns a boolean if a field has been set. + +### GetBindings + +`func (o *FTPServiceStatus) GetBindings() []FTPDBinding` + +GetBindings returns the Bindings field if non-nil, zero value otherwise. + +### GetBindingsOk + +`func (o *FTPServiceStatus) GetBindingsOk() (*[]FTPDBinding, bool)` + +GetBindingsOk returns a tuple with the Bindings field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBindings + +`func (o *FTPServiceStatus) SetBindings(v []FTPDBinding)` + +SetBindings sets Bindings field to given value. + +### HasBindings + +`func (o *FTPServiceStatus) HasBindings() bool` + +HasBindings returns a boolean if a field has been set. + +### SetBindingsNil + +`func (o *FTPServiceStatus) SetBindingsNil(b bool)` + + SetBindingsNil sets the value for Bindings to be an explicit nil + +### UnsetBindings +`func (o *FTPServiceStatus) UnsetBindings()` + +UnsetBindings ensures that no value is present for Bindings, not even an explicit nil +### GetPassivePortRange + +`func (o *FTPServiceStatus) GetPassivePortRange() FTPPassivePortRange` + +GetPassivePortRange returns the PassivePortRange field if non-nil, zero value otherwise. + +### GetPassivePortRangeOk + +`func (o *FTPServiceStatus) GetPassivePortRangeOk() (*FTPPassivePortRange, bool)` + +GetPassivePortRangeOk returns a tuple with the PassivePortRange field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassivePortRange + +`func (o *FTPServiceStatus) SetPassivePortRange(v FTPPassivePortRange)` + +SetPassivePortRange sets PassivePortRange field to given value. + +### HasPassivePortRange + +`func (o *FTPServiceStatus) HasPassivePortRange() bool` + +HasPassivePortRange returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/FilesystemConfig.md b/server/common/sftpgo/v2/openapi/docs/FilesystemConfig.md new file mode 100644 index 00000000..4d831e76 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/FilesystemConfig.md @@ -0,0 +1,186 @@ +# FilesystemConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Provider** | Pointer to [**FsProviders**](FsProviders.md) | | [optional] +**S3config** | Pointer to [**S3Config**](S3Config.md) | | [optional] +**Gcsconfig** | Pointer to [**GCSConfig**](GCSConfig.md) | | [optional] +**Azblobconfig** | Pointer to [**AzureBlobFsConfig**](AzureBlobFsConfig.md) | | [optional] +**Cryptconfig** | Pointer to [**CryptFsConfig**](CryptFsConfig.md) | | [optional] +**Sftpconfig** | Pointer to [**SFTPFsConfig**](SFTPFsConfig.md) | | [optional] + +## Methods + +### NewFilesystemConfig + +`func NewFilesystemConfig() *FilesystemConfig` + +NewFilesystemConfig instantiates a new FilesystemConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFilesystemConfigWithDefaults + +`func NewFilesystemConfigWithDefaults() *FilesystemConfig` + +NewFilesystemConfigWithDefaults instantiates a new FilesystemConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetProvider + +`func (o *FilesystemConfig) GetProvider() FsProviders` + +GetProvider returns the Provider field if non-nil, zero value otherwise. + +### GetProviderOk + +`func (o *FilesystemConfig) GetProviderOk() (*FsProviders, bool)` + +GetProviderOk returns a tuple with the Provider field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProvider + +`func (o *FilesystemConfig) SetProvider(v FsProviders)` + +SetProvider sets Provider field to given value. + +### HasProvider + +`func (o *FilesystemConfig) HasProvider() bool` + +HasProvider returns a boolean if a field has been set. + +### GetS3config + +`func (o *FilesystemConfig) GetS3config() S3Config` + +GetS3config returns the S3config field if non-nil, zero value otherwise. + +### GetS3configOk + +`func (o *FilesystemConfig) GetS3configOk() (*S3Config, bool)` + +GetS3configOk returns a tuple with the S3config field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetS3config + +`func (o *FilesystemConfig) SetS3config(v S3Config)` + +SetS3config sets S3config field to given value. + +### HasS3config + +`func (o *FilesystemConfig) HasS3config() bool` + +HasS3config returns a boolean if a field has been set. + +### GetGcsconfig + +`func (o *FilesystemConfig) GetGcsconfig() GCSConfig` + +GetGcsconfig returns the Gcsconfig field if non-nil, zero value otherwise. + +### GetGcsconfigOk + +`func (o *FilesystemConfig) GetGcsconfigOk() (*GCSConfig, bool)` + +GetGcsconfigOk returns a tuple with the Gcsconfig field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGcsconfig + +`func (o *FilesystemConfig) SetGcsconfig(v GCSConfig)` + +SetGcsconfig sets Gcsconfig field to given value. + +### HasGcsconfig + +`func (o *FilesystemConfig) HasGcsconfig() bool` + +HasGcsconfig returns a boolean if a field has been set. + +### GetAzblobconfig + +`func (o *FilesystemConfig) GetAzblobconfig() AzureBlobFsConfig` + +GetAzblobconfig returns the Azblobconfig field if non-nil, zero value otherwise. + +### GetAzblobconfigOk + +`func (o *FilesystemConfig) GetAzblobconfigOk() (*AzureBlobFsConfig, bool)` + +GetAzblobconfigOk returns a tuple with the Azblobconfig field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAzblobconfig + +`func (o *FilesystemConfig) SetAzblobconfig(v AzureBlobFsConfig)` + +SetAzblobconfig sets Azblobconfig field to given value. + +### HasAzblobconfig + +`func (o *FilesystemConfig) HasAzblobconfig() bool` + +HasAzblobconfig returns a boolean if a field has been set. + +### GetCryptconfig + +`func (o *FilesystemConfig) GetCryptconfig() CryptFsConfig` + +GetCryptconfig returns the Cryptconfig field if non-nil, zero value otherwise. + +### GetCryptconfigOk + +`func (o *FilesystemConfig) GetCryptconfigOk() (*CryptFsConfig, bool)` + +GetCryptconfigOk returns a tuple with the Cryptconfig field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCryptconfig + +`func (o *FilesystemConfig) SetCryptconfig(v CryptFsConfig)` + +SetCryptconfig sets Cryptconfig field to given value. + +### HasCryptconfig + +`func (o *FilesystemConfig) HasCryptconfig() bool` + +HasCryptconfig returns a boolean if a field has been set. + +### GetSftpconfig + +`func (o *FilesystemConfig) GetSftpconfig() SFTPFsConfig` + +GetSftpconfig returns the Sftpconfig field if non-nil, zero value otherwise. + +### GetSftpconfigOk + +`func (o *FilesystemConfig) GetSftpconfigOk() (*SFTPFsConfig, bool)` + +GetSftpconfigOk returns a tuple with the Sftpconfig field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSftpconfig + +`func (o *FilesystemConfig) SetSftpconfig(v SFTPFsConfig)` + +SetSftpconfig sets Sftpconfig field to given value. + +### HasSftpconfig + +`func (o *FilesystemConfig) HasSftpconfig() bool` + +HasSftpconfig returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/FolderQuotaScan.md b/server/common/sftpgo/v2/openapi/docs/FolderQuotaScan.md new file mode 100644 index 00000000..be028dbd --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/FolderQuotaScan.md @@ -0,0 +1,82 @@ +# FolderQuotaScan + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | folder name to which the quota scan refers | [optional] +**StartTime** | Pointer to **int64** | scan start time as unix timestamp in milliseconds | [optional] + +## Methods + +### NewFolderQuotaScan + +`func NewFolderQuotaScan() *FolderQuotaScan` + +NewFolderQuotaScan instantiates a new FolderQuotaScan object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFolderQuotaScanWithDefaults + +`func NewFolderQuotaScanWithDefaults() *FolderQuotaScan` + +NewFolderQuotaScanWithDefaults instantiates a new FolderQuotaScan object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *FolderQuotaScan) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *FolderQuotaScan) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *FolderQuotaScan) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *FolderQuotaScan) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetStartTime + +`func (o *FolderQuotaScan) GetStartTime() int64` + +GetStartTime returns the StartTime field if non-nil, zero value otherwise. + +### GetStartTimeOk + +`func (o *FolderQuotaScan) GetStartTimeOk() (*int64, bool)` + +GetStartTimeOk returns a tuple with the StartTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStartTime + +`func (o *FolderQuotaScan) SetStartTime(v int64)` + +SetStartTime sets StartTime field to given value. + +### HasStartTime + +`func (o *FolderQuotaScan) HasStartTime() bool` + +HasStartTime returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/FolderRetention.md b/server/common/sftpgo/v2/openapi/docs/FolderRetention.md new file mode 100644 index 00000000..76a8b0b4 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/FolderRetention.md @@ -0,0 +1,134 @@ +# FolderRetention + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Path** | Pointer to **string** | exposed virtual directory path, if no other specific retention is defined, the retention applies for sub directories too. For example if retention is defined for the paths \"/\" and \"/sub\" then the retention for \"/\" is applied for any file outside the \"/sub\" directory | [optional] +**Retention** | Pointer to **int32** | retention time in hours. All the files with a modification time older than the defined value will be deleted. 0 means exclude this path | [optional] +**DeleteEmptyDirs** | Pointer to **bool** | if enabled, empty directories will be deleted | [optional] +**IgnoreUserPermissions** | Pointer to **bool** | if enabled, files will be deleted even if the user does not have the delete permission. The default is \"false\" which means that files will be skipped if the user does not have permission to delete them. File patterns filters will always be silently ignored | [optional] + +## Methods + +### NewFolderRetention + +`func NewFolderRetention() *FolderRetention` + +NewFolderRetention instantiates a new FolderRetention object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFolderRetentionWithDefaults + +`func NewFolderRetentionWithDefaults() *FolderRetention` + +NewFolderRetentionWithDefaults instantiates a new FolderRetention object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetPath + +`func (o *FolderRetention) GetPath() string` + +GetPath returns the Path field if non-nil, zero value otherwise. + +### GetPathOk + +`func (o *FolderRetention) GetPathOk() (*string, bool)` + +GetPathOk returns a tuple with the Path field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPath + +`func (o *FolderRetention) SetPath(v string)` + +SetPath sets Path field to given value. + +### HasPath + +`func (o *FolderRetention) HasPath() bool` + +HasPath returns a boolean if a field has been set. + +### GetRetention + +`func (o *FolderRetention) GetRetention() int32` + +GetRetention returns the Retention field if non-nil, zero value otherwise. + +### GetRetentionOk + +`func (o *FolderRetention) GetRetentionOk() (*int32, bool)` + +GetRetentionOk returns a tuple with the Retention field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRetention + +`func (o *FolderRetention) SetRetention(v int32)` + +SetRetention sets Retention field to given value. + +### HasRetention + +`func (o *FolderRetention) HasRetention() bool` + +HasRetention returns a boolean if a field has been set. + +### GetDeleteEmptyDirs + +`func (o *FolderRetention) GetDeleteEmptyDirs() bool` + +GetDeleteEmptyDirs returns the DeleteEmptyDirs field if non-nil, zero value otherwise. + +### GetDeleteEmptyDirsOk + +`func (o *FolderRetention) GetDeleteEmptyDirsOk() (*bool, bool)` + +GetDeleteEmptyDirsOk returns a tuple with the DeleteEmptyDirs field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeleteEmptyDirs + +`func (o *FolderRetention) SetDeleteEmptyDirs(v bool)` + +SetDeleteEmptyDirs sets DeleteEmptyDirs field to given value. + +### HasDeleteEmptyDirs + +`func (o *FolderRetention) HasDeleteEmptyDirs() bool` + +HasDeleteEmptyDirs returns a boolean if a field has been set. + +### GetIgnoreUserPermissions + +`func (o *FolderRetention) GetIgnoreUserPermissions() bool` + +GetIgnoreUserPermissions returns the IgnoreUserPermissions field if non-nil, zero value otherwise. + +### GetIgnoreUserPermissionsOk + +`func (o *FolderRetention) GetIgnoreUserPermissionsOk() (*bool, bool)` + +GetIgnoreUserPermissionsOk returns a tuple with the IgnoreUserPermissions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIgnoreUserPermissions + +`func (o *FolderRetention) SetIgnoreUserPermissions(v bool)` + +SetIgnoreUserPermissions sets IgnoreUserPermissions field to given value. + +### HasIgnoreUserPermissions + +`func (o *FolderRetention) HasIgnoreUserPermissions() bool` + +HasIgnoreUserPermissions returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/FoldersApi.md b/server/common/sftpgo/v2/openapi/docs/FoldersApi.md new file mode 100644 index 00000000..c92acb3f --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/FoldersApi.md @@ -0,0 +1,361 @@ +# \FoldersApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddFolder**](FoldersApi.md#AddFolder) | **Post** /folders | Add folder +[**DeleteFolder**](FoldersApi.md#DeleteFolder) | **Delete** /folders/{name} | Delete folder +[**GetFolderByName**](FoldersApi.md#GetFolderByName) | **Get** /folders/{name} | Find folders by name +[**GetFolders**](FoldersApi.md#GetFolders) | **Get** /folders | Get folders +[**UpdateFolder**](FoldersApi.md#UpdateFolder) | **Put** /folders/{name} | Update folder + + + +## AddFolder + +> BaseVirtualFolder AddFolder(ctx).BaseVirtualFolder(baseVirtualFolder).Execute() + +Add folder + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + baseVirtualFolder := *openapiclient.NewBaseVirtualFolder() // BaseVirtualFolder | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FoldersApi.AddFolder(context.Background()).BaseVirtualFolder(baseVirtualFolder).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FoldersApi.AddFolder``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AddFolder`: BaseVirtualFolder + fmt.Fprintf(os.Stdout, "Response from `FoldersApi.AddFolder`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddFolderRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **baseVirtualFolder** | [**BaseVirtualFolder**](BaseVirtualFolder.md) | | + +### Return type + +[**BaseVirtualFolder**](BaseVirtualFolder.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteFolder + +> ApiResponse DeleteFolder(ctx, name).Execute() + +Delete folder + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + name := "name_example" // string | folder name + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FoldersApi.DeleteFolder(context.Background(), name).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FoldersApi.DeleteFolder``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DeleteFolder`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `FoldersApi.DeleteFolder`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**name** | **string** | folder name | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteFolderRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetFolderByName + +> BaseVirtualFolder GetFolderByName(ctx, name).Execute() + +Find folders by name + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + name := "name_example" // string | folder name + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FoldersApi.GetFolderByName(context.Background(), name).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FoldersApi.GetFolderByName``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetFolderByName`: BaseVirtualFolder + fmt.Fprintf(os.Stdout, "Response from `FoldersApi.GetFolderByName`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**name** | **string** | folder name | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetFolderByNameRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**BaseVirtualFolder**](BaseVirtualFolder.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetFolders + +> []BaseVirtualFolder GetFolders(ctx).Offset(offset).Limit(limit).Order(order).Execute() + +Get folders + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + offset := int32(56) // int32 | (optional) (default to 0) + limit := int32(56) // int32 | The maximum number of items to return. Max value is 500, default is 100 (optional) (default to 100) + order := "ASC" // string | Ordering folders by path. Default ASC (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FoldersApi.GetFolders(context.Background()).Offset(offset).Limit(limit).Order(order).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FoldersApi.GetFolders``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetFolders`: []BaseVirtualFolder + fmt.Fprintf(os.Stdout, "Response from `FoldersApi.GetFolders`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetFoldersRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **offset** | **int32** | | [default to 0] + **limit** | **int32** | The maximum number of items to return. Max value is 500, default is 100 | [default to 100] + **order** | **string** | Ordering folders by path. Default ASC | + +### Return type + +[**[]BaseVirtualFolder**](BaseVirtualFolder.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateFolder + +> ApiResponse UpdateFolder(ctx, name).BaseVirtualFolder(baseVirtualFolder).Execute() + +Update folder + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + name := "name_example" // string | folder name + baseVirtualFolder := *openapiclient.NewBaseVirtualFolder() // BaseVirtualFolder | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FoldersApi.UpdateFolder(context.Background(), name).BaseVirtualFolder(baseVirtualFolder).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FoldersApi.UpdateFolder``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateFolder`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `FoldersApi.UpdateFolder`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**name** | **string** | folder name | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateFolderRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **baseVirtualFolder** | [**BaseVirtualFolder**](BaseVirtualFolder.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/FsEvent.md b/server/common/sftpgo/v2/openapi/docs/FsEvent.md new file mode 100644 index 00000000..74f84ed7 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/FsEvent.md @@ -0,0 +1,524 @@ +# FsEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] +**Timestamp** | Pointer to **int64** | unix timestamp in nanoseconds | [optional] +**Action** | Pointer to [**FsEventAction**](FsEventAction.md) | | [optional] +**Username** | Pointer to **string** | | [optional] +**FsPath** | Pointer to **string** | | [optional] +**FsTargetPath** | Pointer to **string** | | [optional] +**VirtualPath** | Pointer to **string** | | [optional] +**VirtualTargetPath** | Pointer to **string** | | [optional] +**SshCmd** | Pointer to **string** | | [optional] +**FileSize** | Pointer to **int64** | | [optional] +**Status** | Pointer to [**FsEventStatus**](FsEventStatus.md) | | [optional] +**Protocol** | Pointer to [**EventProtocols**](EventProtocols.md) | | [optional] +**Ip** | Pointer to **string** | | [optional] +**SessionId** | Pointer to **string** | | [optional] +**FsProvider** | Pointer to [**FsProviders**](FsProviders.md) | | [optional] +**Bucket** | Pointer to **string** | | [optional] +**Endpoint** | Pointer to **string** | | [optional] +**OpenFlags** | Pointer to **string** | | [optional] +**InstanceId** | Pointer to **string** | | [optional] + +## Methods + +### NewFsEvent + +`func NewFsEvent() *FsEvent` + +NewFsEvent instantiates a new FsEvent object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFsEventWithDefaults + +`func NewFsEventWithDefaults() *FsEvent` + +NewFsEventWithDefaults instantiates a new FsEvent object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *FsEvent) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *FsEvent) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *FsEvent) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *FsEvent) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetTimestamp + +`func (o *FsEvent) GetTimestamp() int64` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *FsEvent) GetTimestampOk() (*int64, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *FsEvent) SetTimestamp(v int64)` + +SetTimestamp sets Timestamp field to given value. + +### HasTimestamp + +`func (o *FsEvent) HasTimestamp() bool` + +HasTimestamp returns a boolean if a field has been set. + +### GetAction + +`func (o *FsEvent) GetAction() FsEventAction` + +GetAction returns the Action field if non-nil, zero value otherwise. + +### GetActionOk + +`func (o *FsEvent) GetActionOk() (*FsEventAction, bool)` + +GetActionOk returns a tuple with the Action field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAction + +`func (o *FsEvent) SetAction(v FsEventAction)` + +SetAction sets Action field to given value. + +### HasAction + +`func (o *FsEvent) HasAction() bool` + +HasAction returns a boolean if a field has been set. + +### GetUsername + +`func (o *FsEvent) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *FsEvent) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *FsEvent) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *FsEvent) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetFsPath + +`func (o *FsEvent) GetFsPath() string` + +GetFsPath returns the FsPath field if non-nil, zero value otherwise. + +### GetFsPathOk + +`func (o *FsEvent) GetFsPathOk() (*string, bool)` + +GetFsPathOk returns a tuple with the FsPath field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFsPath + +`func (o *FsEvent) SetFsPath(v string)` + +SetFsPath sets FsPath field to given value. + +### HasFsPath + +`func (o *FsEvent) HasFsPath() bool` + +HasFsPath returns a boolean if a field has been set. + +### GetFsTargetPath + +`func (o *FsEvent) GetFsTargetPath() string` + +GetFsTargetPath returns the FsTargetPath field if non-nil, zero value otherwise. + +### GetFsTargetPathOk + +`func (o *FsEvent) GetFsTargetPathOk() (*string, bool)` + +GetFsTargetPathOk returns a tuple with the FsTargetPath field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFsTargetPath + +`func (o *FsEvent) SetFsTargetPath(v string)` + +SetFsTargetPath sets FsTargetPath field to given value. + +### HasFsTargetPath + +`func (o *FsEvent) HasFsTargetPath() bool` + +HasFsTargetPath returns a boolean if a field has been set. + +### GetVirtualPath + +`func (o *FsEvent) GetVirtualPath() string` + +GetVirtualPath returns the VirtualPath field if non-nil, zero value otherwise. + +### GetVirtualPathOk + +`func (o *FsEvent) GetVirtualPathOk() (*string, bool)` + +GetVirtualPathOk returns a tuple with the VirtualPath field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVirtualPath + +`func (o *FsEvent) SetVirtualPath(v string)` + +SetVirtualPath sets VirtualPath field to given value. + +### HasVirtualPath + +`func (o *FsEvent) HasVirtualPath() bool` + +HasVirtualPath returns a boolean if a field has been set. + +### GetVirtualTargetPath + +`func (o *FsEvent) GetVirtualTargetPath() string` + +GetVirtualTargetPath returns the VirtualTargetPath field if non-nil, zero value otherwise. + +### GetVirtualTargetPathOk + +`func (o *FsEvent) GetVirtualTargetPathOk() (*string, bool)` + +GetVirtualTargetPathOk returns a tuple with the VirtualTargetPath field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVirtualTargetPath + +`func (o *FsEvent) SetVirtualTargetPath(v string)` + +SetVirtualTargetPath sets VirtualTargetPath field to given value. + +### HasVirtualTargetPath + +`func (o *FsEvent) HasVirtualTargetPath() bool` + +HasVirtualTargetPath returns a boolean if a field has been set. + +### GetSshCmd + +`func (o *FsEvent) GetSshCmd() string` + +GetSshCmd returns the SshCmd field if non-nil, zero value otherwise. + +### GetSshCmdOk + +`func (o *FsEvent) GetSshCmdOk() (*string, bool)` + +GetSshCmdOk returns a tuple with the SshCmd field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSshCmd + +`func (o *FsEvent) SetSshCmd(v string)` + +SetSshCmd sets SshCmd field to given value. + +### HasSshCmd + +`func (o *FsEvent) HasSshCmd() bool` + +HasSshCmd returns a boolean if a field has been set. + +### GetFileSize + +`func (o *FsEvent) GetFileSize() int64` + +GetFileSize returns the FileSize field if non-nil, zero value otherwise. + +### GetFileSizeOk + +`func (o *FsEvent) GetFileSizeOk() (*int64, bool)` + +GetFileSizeOk returns a tuple with the FileSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFileSize + +`func (o *FsEvent) SetFileSize(v int64)` + +SetFileSize sets FileSize field to given value. + +### HasFileSize + +`func (o *FsEvent) HasFileSize() bool` + +HasFileSize returns a boolean if a field has been set. + +### GetStatus + +`func (o *FsEvent) GetStatus() FsEventStatus` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *FsEvent) GetStatusOk() (*FsEventStatus, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *FsEvent) SetStatus(v FsEventStatus)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *FsEvent) HasStatus() bool` + +HasStatus returns a boolean if a field has been set. + +### GetProtocol + +`func (o *FsEvent) GetProtocol() EventProtocols` + +GetProtocol returns the Protocol field if non-nil, zero value otherwise. + +### GetProtocolOk + +`func (o *FsEvent) GetProtocolOk() (*EventProtocols, bool)` + +GetProtocolOk returns a tuple with the Protocol field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProtocol + +`func (o *FsEvent) SetProtocol(v EventProtocols)` + +SetProtocol sets Protocol field to given value. + +### HasProtocol + +`func (o *FsEvent) HasProtocol() bool` + +HasProtocol returns a boolean if a field has been set. + +### GetIp + +`func (o *FsEvent) GetIp() string` + +GetIp returns the Ip field if non-nil, zero value otherwise. + +### GetIpOk + +`func (o *FsEvent) GetIpOk() (*string, bool)` + +GetIpOk returns a tuple with the Ip field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIp + +`func (o *FsEvent) SetIp(v string)` + +SetIp sets Ip field to given value. + +### HasIp + +`func (o *FsEvent) HasIp() bool` + +HasIp returns a boolean if a field has been set. + +### GetSessionId + +`func (o *FsEvent) GetSessionId() string` + +GetSessionId returns the SessionId field if non-nil, zero value otherwise. + +### GetSessionIdOk + +`func (o *FsEvent) GetSessionIdOk() (*string, bool)` + +GetSessionIdOk returns a tuple with the SessionId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSessionId + +`func (o *FsEvent) SetSessionId(v string)` + +SetSessionId sets SessionId field to given value. + +### HasSessionId + +`func (o *FsEvent) HasSessionId() bool` + +HasSessionId returns a boolean if a field has been set. + +### GetFsProvider + +`func (o *FsEvent) GetFsProvider() FsProviders` + +GetFsProvider returns the FsProvider field if non-nil, zero value otherwise. + +### GetFsProviderOk + +`func (o *FsEvent) GetFsProviderOk() (*FsProviders, bool)` + +GetFsProviderOk returns a tuple with the FsProvider field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFsProvider + +`func (o *FsEvent) SetFsProvider(v FsProviders)` + +SetFsProvider sets FsProvider field to given value. + +### HasFsProvider + +`func (o *FsEvent) HasFsProvider() bool` + +HasFsProvider returns a boolean if a field has been set. + +### GetBucket + +`func (o *FsEvent) GetBucket() string` + +GetBucket returns the Bucket field if non-nil, zero value otherwise. + +### GetBucketOk + +`func (o *FsEvent) GetBucketOk() (*string, bool)` + +GetBucketOk returns a tuple with the Bucket field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBucket + +`func (o *FsEvent) SetBucket(v string)` + +SetBucket sets Bucket field to given value. + +### HasBucket + +`func (o *FsEvent) HasBucket() bool` + +HasBucket returns a boolean if a field has been set. + +### GetEndpoint + +`func (o *FsEvent) GetEndpoint() string` + +GetEndpoint returns the Endpoint field if non-nil, zero value otherwise. + +### GetEndpointOk + +`func (o *FsEvent) GetEndpointOk() (*string, bool)` + +GetEndpointOk returns a tuple with the Endpoint field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEndpoint + +`func (o *FsEvent) SetEndpoint(v string)` + +SetEndpoint sets Endpoint field to given value. + +### HasEndpoint + +`func (o *FsEvent) HasEndpoint() bool` + +HasEndpoint returns a boolean if a field has been set. + +### GetOpenFlags + +`func (o *FsEvent) GetOpenFlags() string` + +GetOpenFlags returns the OpenFlags field if non-nil, zero value otherwise. + +### GetOpenFlagsOk + +`func (o *FsEvent) GetOpenFlagsOk() (*string, bool)` + +GetOpenFlagsOk returns a tuple with the OpenFlags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOpenFlags + +`func (o *FsEvent) SetOpenFlags(v string)` + +SetOpenFlags sets OpenFlags field to given value. + +### HasOpenFlags + +`func (o *FsEvent) HasOpenFlags() bool` + +HasOpenFlags returns a boolean if a field has been set. + +### GetInstanceId + +`func (o *FsEvent) GetInstanceId() string` + +GetInstanceId returns the InstanceId field if non-nil, zero value otherwise. + +### GetInstanceIdOk + +`func (o *FsEvent) GetInstanceIdOk() (*string, bool)` + +GetInstanceIdOk returns a tuple with the InstanceId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInstanceId + +`func (o *FsEvent) SetInstanceId(v string)` + +SetInstanceId sets InstanceId field to given value. + +### HasInstanceId + +`func (o *FsEvent) HasInstanceId() bool` + +HasInstanceId returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/FsEventAction.md b/server/common/sftpgo/v2/openapi/docs/FsEventAction.md new file mode 100644 index 00000000..6475a9ed --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/FsEventAction.md @@ -0,0 +1,25 @@ +# FsEventAction + +## Enum + + +* `DOWNLOAD` (value: `"download"`) + +* `PRE_UPLOAD` (value: `"pre-upload"`) + +* `UPLOAD` (value: `"upload"`) + +* `DELETE` (value: `"delete"`) + +* `RENAME` (value: `"rename"`) + +* `MKDIR` (value: `"mkdir"`) + +* `RMDIR` (value: `"rmdir"`) + +* `SSH_CMD` (value: `"ssh_cmd"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/FsEventStatus.md b/server/common/sftpgo/v2/openapi/docs/FsEventStatus.md new file mode 100644 index 00000000..72a1ee19 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/FsEventStatus.md @@ -0,0 +1,15 @@ +# FsEventStatus + +## Enum + + +* `_1` (value: `1`) + +* `_2` (value: `2`) + +* `_3` (value: `3`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/FsProviders.md b/server/common/sftpgo/v2/openapi/docs/FsProviders.md new file mode 100644 index 00000000..c0245d41 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/FsProviders.md @@ -0,0 +1,21 @@ +# FsProviders + +## Enum + + +* `_0` (value: `0`) + +* `_1` (value: `1`) + +* `_2` (value: `2`) + +* `_3` (value: `3`) + +* `_4` (value: `4`) + +* `_5` (value: `5`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/GCSConfig.md b/server/common/sftpgo/v2/openapi/docs/GCSConfig.md new file mode 100644 index 00000000..32dd638a --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/GCSConfig.md @@ -0,0 +1,186 @@ +# GCSConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bucket** | Pointer to **string** | | [optional] +**Credentials** | Pointer to [**Secret**](Secret.md) | | [optional] +**AutomaticCredentials** | Pointer to **int32** | Automatic credentials: * `0` - disabled, explicit credentials, using a JSON credentials file, must be provided. This is the default value if the field is null * `1` - enabled, we try to use the Application Default Credentials (ADC) strategy to find your application's credentials | [optional] +**StorageClass** | Pointer to **string** | | [optional] +**Acl** | Pointer to **string** | The ACL to apply to uploaded objects. Leave empty to use the default ACL. For more information and available ACLs, refer to the JSON API here: https://cloud.google.com/storage/docs/access-control/lists#predefined-acl | [optional] +**KeyPrefix** | Pointer to **string** | key_prefix is similar to a chroot directory for a local filesystem. If specified the user will only see contents that starts with this prefix and so you can restrict access to a specific virtual folder. The prefix, if not empty, must not start with \"/\" and must end with \"/\". If empty the whole bucket contents will be available | [optional] + +## Methods + +### NewGCSConfig + +`func NewGCSConfig() *GCSConfig` + +NewGCSConfig instantiates a new GCSConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGCSConfigWithDefaults + +`func NewGCSConfigWithDefaults() *GCSConfig` + +NewGCSConfigWithDefaults instantiates a new GCSConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBucket + +`func (o *GCSConfig) GetBucket() string` + +GetBucket returns the Bucket field if non-nil, zero value otherwise. + +### GetBucketOk + +`func (o *GCSConfig) GetBucketOk() (*string, bool)` + +GetBucketOk returns a tuple with the Bucket field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBucket + +`func (o *GCSConfig) SetBucket(v string)` + +SetBucket sets Bucket field to given value. + +### HasBucket + +`func (o *GCSConfig) HasBucket() bool` + +HasBucket returns a boolean if a field has been set. + +### GetCredentials + +`func (o *GCSConfig) GetCredentials() Secret` + +GetCredentials returns the Credentials field if non-nil, zero value otherwise. + +### GetCredentialsOk + +`func (o *GCSConfig) GetCredentialsOk() (*Secret, bool)` + +GetCredentialsOk returns a tuple with the Credentials field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCredentials + +`func (o *GCSConfig) SetCredentials(v Secret)` + +SetCredentials sets Credentials field to given value. + +### HasCredentials + +`func (o *GCSConfig) HasCredentials() bool` + +HasCredentials returns a boolean if a field has been set. + +### GetAutomaticCredentials + +`func (o *GCSConfig) GetAutomaticCredentials() int32` + +GetAutomaticCredentials returns the AutomaticCredentials field if non-nil, zero value otherwise. + +### GetAutomaticCredentialsOk + +`func (o *GCSConfig) GetAutomaticCredentialsOk() (*int32, bool)` + +GetAutomaticCredentialsOk returns a tuple with the AutomaticCredentials field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAutomaticCredentials + +`func (o *GCSConfig) SetAutomaticCredentials(v int32)` + +SetAutomaticCredentials sets AutomaticCredentials field to given value. + +### HasAutomaticCredentials + +`func (o *GCSConfig) HasAutomaticCredentials() bool` + +HasAutomaticCredentials returns a boolean if a field has been set. + +### GetStorageClass + +`func (o *GCSConfig) GetStorageClass() string` + +GetStorageClass returns the StorageClass field if non-nil, zero value otherwise. + +### GetStorageClassOk + +`func (o *GCSConfig) GetStorageClassOk() (*string, bool)` + +GetStorageClassOk returns a tuple with the StorageClass field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStorageClass + +`func (o *GCSConfig) SetStorageClass(v string)` + +SetStorageClass sets StorageClass field to given value. + +### HasStorageClass + +`func (o *GCSConfig) HasStorageClass() bool` + +HasStorageClass returns a boolean if a field has been set. + +### GetAcl + +`func (o *GCSConfig) GetAcl() string` + +GetAcl returns the Acl field if non-nil, zero value otherwise. + +### GetAclOk + +`func (o *GCSConfig) GetAclOk() (*string, bool)` + +GetAclOk returns a tuple with the Acl field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAcl + +`func (o *GCSConfig) SetAcl(v string)` + +SetAcl sets Acl field to given value. + +### HasAcl + +`func (o *GCSConfig) HasAcl() bool` + +HasAcl returns a boolean if a field has been set. + +### GetKeyPrefix + +`func (o *GCSConfig) GetKeyPrefix() string` + +GetKeyPrefix returns the KeyPrefix field if non-nil, zero value otherwise. + +### GetKeyPrefixOk + +`func (o *GCSConfig) GetKeyPrefixOk() (*string, bool)` + +GetKeyPrefixOk returns a tuple with the KeyPrefix field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKeyPrefix + +`func (o *GCSConfig) SetKeyPrefix(v string)` + +SetKeyPrefix sets KeyPrefix field to given value. + +### HasKeyPrefix + +`func (o *GCSConfig) HasKeyPrefix() bool` + +HasKeyPrefix returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/HealthcheckApi.md b/server/common/sftpgo/v2/openapi/docs/HealthcheckApi.md new file mode 100644 index 00000000..6b69968c --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/HealthcheckApi.md @@ -0,0 +1,70 @@ +# \HealthcheckApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Healthz**](HealthcheckApi.md#Healthz) | **Get** /healthz | health check + + + +## Healthz + +> string Healthz(ctx).Execute() + +health check + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.HealthcheckApi.Healthz(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `HealthcheckApi.Healthz``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Healthz`: string + fmt.Fprintf(os.Stdout, "Response from `HealthcheckApi.Healthz`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiHealthzRequest struct via the builder pattern + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/HooksFilter.md b/server/common/sftpgo/v2/openapi/docs/HooksFilter.md new file mode 100644 index 00000000..ca0dc453 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/HooksFilter.md @@ -0,0 +1,108 @@ +# HooksFilter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ExternalAuthDisabled** | Pointer to **bool** | If true, the external auth hook, if defined, will not be executed | [optional] +**PreLoginDisabled** | Pointer to **bool** | If true, the pre-login hook, if defined, will not be executed | [optional] +**CheckPasswordDisabled** | Pointer to **bool** | If true, the check password hook, if defined, will not be executed | [optional] + +## Methods + +### NewHooksFilter + +`func NewHooksFilter() *HooksFilter` + +NewHooksFilter instantiates a new HooksFilter object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewHooksFilterWithDefaults + +`func NewHooksFilterWithDefaults() *HooksFilter` + +NewHooksFilterWithDefaults instantiates a new HooksFilter object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetExternalAuthDisabled + +`func (o *HooksFilter) GetExternalAuthDisabled() bool` + +GetExternalAuthDisabled returns the ExternalAuthDisabled field if non-nil, zero value otherwise. + +### GetExternalAuthDisabledOk + +`func (o *HooksFilter) GetExternalAuthDisabledOk() (*bool, bool)` + +GetExternalAuthDisabledOk returns a tuple with the ExternalAuthDisabled field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetExternalAuthDisabled + +`func (o *HooksFilter) SetExternalAuthDisabled(v bool)` + +SetExternalAuthDisabled sets ExternalAuthDisabled field to given value. + +### HasExternalAuthDisabled + +`func (o *HooksFilter) HasExternalAuthDisabled() bool` + +HasExternalAuthDisabled returns a boolean if a field has been set. + +### GetPreLoginDisabled + +`func (o *HooksFilter) GetPreLoginDisabled() bool` + +GetPreLoginDisabled returns the PreLoginDisabled field if non-nil, zero value otherwise. + +### GetPreLoginDisabledOk + +`func (o *HooksFilter) GetPreLoginDisabledOk() (*bool, bool)` + +GetPreLoginDisabledOk returns a tuple with the PreLoginDisabled field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPreLoginDisabled + +`func (o *HooksFilter) SetPreLoginDisabled(v bool)` + +SetPreLoginDisabled sets PreLoginDisabled field to given value. + +### HasPreLoginDisabled + +`func (o *HooksFilter) HasPreLoginDisabled() bool` + +HasPreLoginDisabled returns a boolean if a field has been set. + +### GetCheckPasswordDisabled + +`func (o *HooksFilter) GetCheckPasswordDisabled() bool` + +GetCheckPasswordDisabled returns the CheckPasswordDisabled field if non-nil, zero value otherwise. + +### GetCheckPasswordDisabledOk + +`func (o *HooksFilter) GetCheckPasswordDisabledOk() (*bool, bool)` + +GetCheckPasswordDisabledOk returns a tuple with the CheckPasswordDisabled field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCheckPasswordDisabled + +`func (o *HooksFilter) SetCheckPasswordDisabled(v bool)` + +SetCheckPasswordDisabled sets CheckPasswordDisabled field to given value. + +### HasCheckPasswordDisabled + +`func (o *HooksFilter) HasCheckPasswordDisabled() bool` + +HasCheckPasswordDisabled returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/InlineObject1.md b/server/common/sftpgo/v2/openapi/docs/InlineObject1.md new file mode 100644 index 00000000..061c3185 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/InlineObject1.md @@ -0,0 +1,56 @@ +# InlineObject1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ConfigName** | Pointer to **string** | name of the configuration to use to generate the secret | [optional] + +## Methods + +### NewInlineObject1 + +`func NewInlineObject1() *InlineObject1` + +NewInlineObject1 instantiates a new InlineObject1 object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInlineObject1WithDefaults + +`func NewInlineObject1WithDefaults() *InlineObject1` + +NewInlineObject1WithDefaults instantiates a new InlineObject1 object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetConfigName + +`func (o *InlineObject1) GetConfigName() string` + +GetConfigName returns the ConfigName field if non-nil, zero value otherwise. + +### GetConfigNameOk + +`func (o *InlineObject1) GetConfigNameOk() (*string, bool)` + +GetConfigNameOk returns a tuple with the ConfigName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfigName + +`func (o *InlineObject1) SetConfigName(v string)` + +SetConfigName sets ConfigName field to given value. + +### HasConfigName + +`func (o *InlineObject1) HasConfigName() bool` + +HasConfigName returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/InlineObject2.md b/server/common/sftpgo/v2/openapi/docs/InlineObject2.md new file mode 100644 index 00000000..20f4fdec --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/InlineObject2.md @@ -0,0 +1,108 @@ +# InlineObject2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ConfigName** | Pointer to **string** | name of the configuration to use to validate the passcode | [optional] +**Passcode** | Pointer to **string** | passcode to validate | [optional] +**Secret** | Pointer to **string** | secret to use to validate the passcode | [optional] + +## Methods + +### NewInlineObject2 + +`func NewInlineObject2() *InlineObject2` + +NewInlineObject2 instantiates a new InlineObject2 object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInlineObject2WithDefaults + +`func NewInlineObject2WithDefaults() *InlineObject2` + +NewInlineObject2WithDefaults instantiates a new InlineObject2 object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetConfigName + +`func (o *InlineObject2) GetConfigName() string` + +GetConfigName returns the ConfigName field if non-nil, zero value otherwise. + +### GetConfigNameOk + +`func (o *InlineObject2) GetConfigNameOk() (*string, bool)` + +GetConfigNameOk returns a tuple with the ConfigName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfigName + +`func (o *InlineObject2) SetConfigName(v string)` + +SetConfigName sets ConfigName field to given value. + +### HasConfigName + +`func (o *InlineObject2) HasConfigName() bool` + +HasConfigName returns a boolean if a field has been set. + +### GetPasscode + +`func (o *InlineObject2) GetPasscode() string` + +GetPasscode returns the Passcode field if non-nil, zero value otherwise. + +### GetPasscodeOk + +`func (o *InlineObject2) GetPasscodeOk() (*string, bool)` + +GetPasscodeOk returns a tuple with the Passcode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPasscode + +`func (o *InlineObject2) SetPasscode(v string)` + +SetPasscode sets Passcode field to given value. + +### HasPasscode + +`func (o *InlineObject2) HasPasscode() bool` + +HasPasscode returns a boolean if a field has been set. + +### GetSecret + +`func (o *InlineObject2) GetSecret() string` + +GetSecret returns the Secret field if non-nil, zero value otherwise. + +### GetSecretOk + +`func (o *InlineObject2) GetSecretOk() (*string, bool)` + +GetSecretOk returns a tuple with the Secret field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSecret + +`func (o *InlineObject2) SetSecret(v string)` + +SetSecret sets Secret field to given value. + +### HasSecret + +`func (o *InlineObject2) HasSecret() bool` + +HasSecret returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/InlineObject3.md b/server/common/sftpgo/v2/openapi/docs/InlineObject3.md new file mode 100644 index 00000000..afb269a9 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/InlineObject3.md @@ -0,0 +1,56 @@ +# InlineObject3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Ip** | Pointer to **string** | IPv4/IPv6 address to remove | [optional] + +## Methods + +### NewInlineObject3 + +`func NewInlineObject3() *InlineObject3` + +NewInlineObject3 instantiates a new InlineObject3 object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInlineObject3WithDefaults + +`func NewInlineObject3WithDefaults() *InlineObject3` + +NewInlineObject3WithDefaults instantiates a new InlineObject3 object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIp + +`func (o *InlineObject3) GetIp() string` + +GetIp returns the Ip field if non-nil, zero value otherwise. + +### GetIpOk + +`func (o *InlineObject3) GetIpOk() (*string, bool)` + +GetIpOk returns a tuple with the Ip field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIp + +`func (o *InlineObject3) SetIp(v string)` + +SetIp sets Ip field to given value. + +### HasIp + +`func (o *InlineObject3) HasIp() bool` + +HasIp returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/InlineObject4.md b/server/common/sftpgo/v2/openapi/docs/InlineObject4.md new file mode 100644 index 00000000..26fba994 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/InlineObject4.md @@ -0,0 +1,82 @@ +# InlineObject4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | Pointer to **string** | | [optional] +**Password** | Pointer to **string** | | [optional] + +## Methods + +### NewInlineObject4 + +`func NewInlineObject4() *InlineObject4` + +NewInlineObject4 instantiates a new InlineObject4 object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInlineObject4WithDefaults + +`func NewInlineObject4WithDefaults() *InlineObject4` + +NewInlineObject4WithDefaults instantiates a new InlineObject4 object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetCode + +`func (o *InlineObject4) GetCode() string` + +GetCode returns the Code field if non-nil, zero value otherwise. + +### GetCodeOk + +`func (o *InlineObject4) GetCodeOk() (*string, bool)` + +GetCodeOk returns a tuple with the Code field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCode + +`func (o *InlineObject4) SetCode(v string)` + +SetCode sets Code field to given value. + +### HasCode + +`func (o *InlineObject4) HasCode() bool` + +HasCode returns a boolean if a field has been set. + +### GetPassword + +`func (o *InlineObject4) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *InlineObject4) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *InlineObject4) SetPassword(v string)` + +SetPassword sets Password field to given value. + +### HasPassword + +`func (o *InlineObject4) HasPassword() bool` + +HasPassword returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/InlineObject5.md b/server/common/sftpgo/v2/openapi/docs/InlineObject5.md new file mode 100644 index 00000000..7c8ab710 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/InlineObject5.md @@ -0,0 +1,82 @@ +# InlineObject5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | Pointer to **string** | | [optional] +**Password** | Pointer to **string** | | [optional] + +## Methods + +### NewInlineObject5 + +`func NewInlineObject5() *InlineObject5` + +NewInlineObject5 instantiates a new InlineObject5 object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInlineObject5WithDefaults + +`func NewInlineObject5WithDefaults() *InlineObject5` + +NewInlineObject5WithDefaults instantiates a new InlineObject5 object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetCode + +`func (o *InlineObject5) GetCode() string` + +GetCode returns the Code field if non-nil, zero value otherwise. + +### GetCodeOk + +`func (o *InlineObject5) GetCodeOk() (*string, bool)` + +GetCodeOk returns a tuple with the Code field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCode + +`func (o *InlineObject5) SetCode(v string)` + +SetCode sets Code field to given value. + +### HasCode + +`func (o *InlineObject5) HasCode() bool` + +HasCode returns a boolean if a field has been set. + +### GetPassword + +`func (o *InlineObject5) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *InlineObject5) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *InlineObject5) SetPassword(v string)` + +SetPassword sets Password field to given value. + +### HasPassword + +`func (o *InlineObject5) HasPassword() bool` + +HasPassword returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/InlineObject6.md b/server/common/sftpgo/v2/openapi/docs/InlineObject6.md new file mode 100644 index 00000000..1fc8bdb2 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/InlineObject6.md @@ -0,0 +1,56 @@ +# InlineObject6 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ConfigName** | Pointer to **string** | name of the configuration to use to generate the secret | [optional] + +## Methods + +### NewInlineObject6 + +`func NewInlineObject6() *InlineObject6` + +NewInlineObject6 instantiates a new InlineObject6 object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInlineObject6WithDefaults + +`func NewInlineObject6WithDefaults() *InlineObject6` + +NewInlineObject6WithDefaults instantiates a new InlineObject6 object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetConfigName + +`func (o *InlineObject6) GetConfigName() string` + +GetConfigName returns the ConfigName field if non-nil, zero value otherwise. + +### GetConfigNameOk + +`func (o *InlineObject6) GetConfigNameOk() (*string, bool)` + +GetConfigNameOk returns a tuple with the ConfigName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfigName + +`func (o *InlineObject6) SetConfigName(v string)` + +SetConfigName sets ConfigName field to given value. + +### HasConfigName + +`func (o *InlineObject6) HasConfigName() bool` + +HasConfigName returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/InlineObject7.md b/server/common/sftpgo/v2/openapi/docs/InlineObject7.md new file mode 100644 index 00000000..fbb1e259 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/InlineObject7.md @@ -0,0 +1,108 @@ +# InlineObject7 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ConfigName** | Pointer to **string** | name of the configuration to use to validate the passcode | [optional] +**Passcode** | Pointer to **string** | passcode to validate | [optional] +**Secret** | Pointer to **string** | secret to use to validate the passcode | [optional] + +## Methods + +### NewInlineObject7 + +`func NewInlineObject7() *InlineObject7` + +NewInlineObject7 instantiates a new InlineObject7 object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInlineObject7WithDefaults + +`func NewInlineObject7WithDefaults() *InlineObject7` + +NewInlineObject7WithDefaults instantiates a new InlineObject7 object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetConfigName + +`func (o *InlineObject7) GetConfigName() string` + +GetConfigName returns the ConfigName field if non-nil, zero value otherwise. + +### GetConfigNameOk + +`func (o *InlineObject7) GetConfigNameOk() (*string, bool)` + +GetConfigNameOk returns a tuple with the ConfigName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfigName + +`func (o *InlineObject7) SetConfigName(v string)` + +SetConfigName sets ConfigName field to given value. + +### HasConfigName + +`func (o *InlineObject7) HasConfigName() bool` + +HasConfigName returns a boolean if a field has been set. + +### GetPasscode + +`func (o *InlineObject7) GetPasscode() string` + +GetPasscode returns the Passcode field if non-nil, zero value otherwise. + +### GetPasscodeOk + +`func (o *InlineObject7) GetPasscodeOk() (*string, bool)` + +GetPasscodeOk returns a tuple with the Passcode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPasscode + +`func (o *InlineObject7) SetPasscode(v string)` + +SetPasscode sets Passcode field to given value. + +### HasPasscode + +`func (o *InlineObject7) HasPasscode() bool` + +HasPasscode returns a boolean if a field has been set. + +### GetSecret + +`func (o *InlineObject7) GetSecret() string` + +GetSecret returns the Secret field if non-nil, zero value otherwise. + +### GetSecretOk + +`func (o *InlineObject7) GetSecretOk() (*string, bool)` + +GetSecretOk returns a tuple with the Secret field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSecret + +`func (o *InlineObject7) SetSecret(v string)` + +SetSecret sets Secret field to given value. + +### HasSecret + +`func (o *InlineObject7) HasSecret() bool` + +HasSecret returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/InlineObject9.md b/server/common/sftpgo/v2/openapi/docs/InlineObject9.md new file mode 100644 index 00000000..b6e2849d --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/InlineObject9.md @@ -0,0 +1,56 @@ +# InlineObject9 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ModificationTime** | Pointer to **int32** | File modification time as unix timestamp in milliseconds | [optional] + +## Methods + +### NewInlineObject9 + +`func NewInlineObject9() *InlineObject9` + +NewInlineObject9 instantiates a new InlineObject9 object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInlineObject9WithDefaults + +`func NewInlineObject9WithDefaults() *InlineObject9` + +NewInlineObject9WithDefaults instantiates a new InlineObject9 object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetModificationTime + +`func (o *InlineObject9) GetModificationTime() int32` + +GetModificationTime returns the ModificationTime field if non-nil, zero value otherwise. + +### GetModificationTimeOk + +`func (o *InlineObject9) GetModificationTimeOk() (*int32, bool)` + +GetModificationTimeOk returns a tuple with the ModificationTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetModificationTime + +`func (o *InlineObject9) SetModificationTime(v int32)` + +SetModificationTime sets ModificationTime field to given value. + +### HasModificationTime + +`func (o *InlineObject9) HasModificationTime() bool` + +HasModificationTime returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/InlineResponse200.md b/server/common/sftpgo/v2/openapi/docs/InlineResponse200.md new file mode 100644 index 00000000..d7653dfe --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/InlineResponse200.md @@ -0,0 +1,134 @@ +# InlineResponse200 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ConfigName** | Pointer to **string** | | [optional] +**Issuer** | Pointer to **string** | | [optional] +**Secret** | Pointer to **string** | | [optional] +**QrCode** | Pointer to **string** | QR code png encoded as BASE64 | [optional] + +## Methods + +### NewInlineResponse200 + +`func NewInlineResponse200() *InlineResponse200` + +NewInlineResponse200 instantiates a new InlineResponse200 object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInlineResponse200WithDefaults + +`func NewInlineResponse200WithDefaults() *InlineResponse200` + +NewInlineResponse200WithDefaults instantiates a new InlineResponse200 object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetConfigName + +`func (o *InlineResponse200) GetConfigName() string` + +GetConfigName returns the ConfigName field if non-nil, zero value otherwise. + +### GetConfigNameOk + +`func (o *InlineResponse200) GetConfigNameOk() (*string, bool)` + +GetConfigNameOk returns a tuple with the ConfigName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfigName + +`func (o *InlineResponse200) SetConfigName(v string)` + +SetConfigName sets ConfigName field to given value. + +### HasConfigName + +`func (o *InlineResponse200) HasConfigName() bool` + +HasConfigName returns a boolean if a field has been set. + +### GetIssuer + +`func (o *InlineResponse200) GetIssuer() string` + +GetIssuer returns the Issuer field if non-nil, zero value otherwise. + +### GetIssuerOk + +`func (o *InlineResponse200) GetIssuerOk() (*string, bool)` + +GetIssuerOk returns a tuple with the Issuer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIssuer + +`func (o *InlineResponse200) SetIssuer(v string)` + +SetIssuer sets Issuer field to given value. + +### HasIssuer + +`func (o *InlineResponse200) HasIssuer() bool` + +HasIssuer returns a boolean if a field has been set. + +### GetSecret + +`func (o *InlineResponse200) GetSecret() string` + +GetSecret returns the Secret field if non-nil, zero value otherwise. + +### GetSecretOk + +`func (o *InlineResponse200) GetSecretOk() (*string, bool)` + +GetSecretOk returns a tuple with the Secret field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSecret + +`func (o *InlineResponse200) SetSecret(v string)` + +SetSecret sets Secret field to given value. + +### HasSecret + +`func (o *InlineResponse200) HasSecret() bool` + +HasSecret returns a boolean if a field has been set. + +### GetQrCode + +`func (o *InlineResponse200) GetQrCode() string` + +GetQrCode returns the QrCode field if non-nil, zero value otherwise. + +### GetQrCodeOk + +`func (o *InlineResponse200) GetQrCodeOk() (*string, bool)` + +GetQrCodeOk returns a tuple with the QrCode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQrCode + +`func (o *InlineResponse200) SetQrCode(v string)` + +SetQrCode sets QrCode field to given value. + +### HasQrCode + +`func (o *InlineResponse200) HasQrCode() bool` + +HasQrCode returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/InlineResponse201.md b/server/common/sftpgo/v2/openapi/docs/InlineResponse201.md new file mode 100644 index 00000000..66673adb --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/InlineResponse201.md @@ -0,0 +1,82 @@ +# InlineResponse201 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Mesage** | Pointer to **string** | | [optional] +**Key** | Pointer to **string** | generated API key | [optional] + +## Methods + +### NewInlineResponse201 + +`func NewInlineResponse201() *InlineResponse201` + +NewInlineResponse201 instantiates a new InlineResponse201 object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInlineResponse201WithDefaults + +`func NewInlineResponse201WithDefaults() *InlineResponse201` + +NewInlineResponse201WithDefaults instantiates a new InlineResponse201 object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetMesage + +`func (o *InlineResponse201) GetMesage() string` + +GetMesage returns the Mesage field if non-nil, zero value otherwise. + +### GetMesageOk + +`func (o *InlineResponse201) GetMesageOk() (*string, bool)` + +GetMesageOk returns a tuple with the Mesage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMesage + +`func (o *InlineResponse201) SetMesage(v string)` + +SetMesage sets Mesage field to given value. + +### HasMesage + +`func (o *InlineResponse201) HasMesage() bool` + +HasMesage returns a boolean if a field has been set. + +### GetKey + +`func (o *InlineResponse201) GetKey() string` + +GetKey returns the Key field if non-nil, zero value otherwise. + +### GetKeyOk + +`func (o *InlineResponse201) GetKeyOk() (*string, bool)` + +GetKeyOk returns a tuple with the Key field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKey + +`func (o *InlineResponse201) SetKey(v string)` + +SetKey sets Key field to given value. + +### HasKey + +`func (o *InlineResponse201) HasKey() bool` + +HasKey returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/LoginMethods.md b/server/common/sftpgo/v2/openapi/docs/LoginMethods.md new file mode 100644 index 00000000..0a414154 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/LoginMethods.md @@ -0,0 +1,23 @@ +# LoginMethods + +## Enum + + +* `PUBLICKEY` (value: `"publickey"`) + +* `PASSWORD` (value: `"password"`) + +* `KEYBOARD_INTERACTIVE` (value: `"keyboard-interactive"`) + +* `PUBLICKEYPASSWORD` (value: `"publickey+password"`) + +* `PUBLICKEYKEYBOARD_INTERACTIVE` (value: `"publickey+keyboard-interactive"`) + +* `TLS_CERTIFICATE` (value: `"TLSCertificate"`) + +* `TLS_CERTIFICATEPASSWORD` (value: `"TLSCertificate+password"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/MFAProtocols.md b/server/common/sftpgo/v2/openapi/docs/MFAProtocols.md new file mode 100644 index 00000000..2422907b --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/MFAProtocols.md @@ -0,0 +1,15 @@ +# MFAProtocols + +## Enum + + +* `SSH` (value: `"SSH"`) + +* `FTP` (value: `"FTP"`) + +* `HTTP` (value: `"HTTP"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/MFAStatus.md b/server/common/sftpgo/v2/openapi/docs/MFAStatus.md new file mode 100644 index 00000000..6425cafc --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/MFAStatus.md @@ -0,0 +1,82 @@ +# MFAStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**IsActive** | Pointer to **bool** | | [optional] +**TotpConfigs** | Pointer to [**[]TOTPConfig**](TOTPConfig.md) | | [optional] + +## Methods + +### NewMFAStatus + +`func NewMFAStatus() *MFAStatus` + +NewMFAStatus instantiates a new MFAStatus object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewMFAStatusWithDefaults + +`func NewMFAStatusWithDefaults() *MFAStatus` + +NewMFAStatusWithDefaults instantiates a new MFAStatus object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIsActive + +`func (o *MFAStatus) GetIsActive() bool` + +GetIsActive returns the IsActive field if non-nil, zero value otherwise. + +### GetIsActiveOk + +`func (o *MFAStatus) GetIsActiveOk() (*bool, bool)` + +GetIsActiveOk returns a tuple with the IsActive field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsActive + +`func (o *MFAStatus) SetIsActive(v bool)` + +SetIsActive sets IsActive field to given value. + +### HasIsActive + +`func (o *MFAStatus) HasIsActive() bool` + +HasIsActive returns a boolean if a field has been set. + +### GetTotpConfigs + +`func (o *MFAStatus) GetTotpConfigs() []TOTPConfig` + +GetTotpConfigs returns the TotpConfigs field if non-nil, zero value otherwise. + +### GetTotpConfigsOk + +`func (o *MFAStatus) GetTotpConfigsOk() (*[]TOTPConfig, bool)` + +GetTotpConfigsOk returns a tuple with the TotpConfigs field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotpConfigs + +`func (o *MFAStatus) SetTotpConfigs(v []TOTPConfig)` + +SetTotpConfigs sets TotpConfigs field to given value. + +### HasTotpConfigs + +`func (o *MFAStatus) HasTotpConfigs() bool` + +HasTotpConfigs returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/MaintenanceApi.md b/server/common/sftpgo/v2/openapi/docs/MaintenanceApi.md new file mode 100644 index 00000000..acb5a4e8 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/MaintenanceApi.md @@ -0,0 +1,345 @@ +# \MaintenanceApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Dumpdata**](MaintenanceApi.md#Dumpdata) | **Get** /dumpdata | Dump data +[**GetStatus**](MaintenanceApi.md#GetStatus) | **Get** /status | Get status +[**GetVersion**](MaintenanceApi.md#GetVersion) | **Get** /version | Get version details +[**LoaddataFromFile**](MaintenanceApi.md#LoaddataFromFile) | **Get** /loaddata | Load data from path +[**LoaddataFromRequestBody**](MaintenanceApi.md#LoaddataFromRequestBody) | **Post** /loaddata | Load data + + + +## Dumpdata + +> BackupData Dumpdata(ctx).OutputFile(outputFile).OutputData(outputData).Indent(indent).Execute() + +Dump data + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + outputFile := "outputFile_example" // string | Path for the file to write the JSON serialized data to. This path is relative to the configured \"backups_path\". If this file already exists it will be overwritten. To return the backup as response body set `output_data` to true instead. (optional) + outputData := int32(56) // int32 | output data: * `0` or any other value != 1, the backup will be saved to a file on the server, `output_file` is required * `1` the backup will be returned as response body (optional) + indent := int32(56) // int32 | indent: * `0` no indentation. This is the default * `1` format the output JSON (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.MaintenanceApi.Dumpdata(context.Background()).OutputFile(outputFile).OutputData(outputData).Indent(indent).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MaintenanceApi.Dumpdata``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Dumpdata`: BackupData + fmt.Fprintf(os.Stdout, "Response from `MaintenanceApi.Dumpdata`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiDumpdataRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outputFile** | **string** | Path for the file to write the JSON serialized data to. This path is relative to the configured \"backups_path\". If this file already exists it will be overwritten. To return the backup as response body set `output_data` to true instead. | + **outputData** | **int32** | output data: * `0` or any other value != 1, the backup will be saved to a file on the server, `output_file` is required * `1` the backup will be returned as response body | + **indent** | **int32** | indent: * `0` no indentation. This is the default * `1` format the output JSON | + +### Return type + +[**BackupData**](BackupData.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetStatus + +> ServicesStatus GetStatus(ctx).Execute() + +Get status + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.MaintenanceApi.GetStatus(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MaintenanceApi.GetStatus``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetStatus`: ServicesStatus + fmt.Fprintf(os.Stdout, "Response from `MaintenanceApi.GetStatus`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetStatusRequest struct via the builder pattern + + +### Return type + +[**ServicesStatus**](ServicesStatus.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetVersion + +> VersionInfo GetVersion(ctx).Execute() + +Get version details + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.MaintenanceApi.GetVersion(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MaintenanceApi.GetVersion``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetVersion`: VersionInfo + fmt.Fprintf(os.Stdout, "Response from `MaintenanceApi.GetVersion`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetVersionRequest struct via the builder pattern + + +### Return type + +[**VersionInfo**](VersionInfo.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LoaddataFromFile + +> ApiResponse LoaddataFromFile(ctx).InputFile(inputFile).ScanQuota(scanQuota).Mode(mode).Execute() + +Load data from path + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + inputFile := "inputFile_example" // string | Path for the file to read the JSON serialized data from. This can be an absolute path or a path relative to the configured \"backups_path\". The max allowed file size is 10MB + scanQuota := int32(56) // int32 | Quota scan: * `0` no quota scan is done, the imported users/folders will have used_quota_size and used_quota_files = 0 or the existing values if they already exists. This is the default * `1` scan quota * `2` scan quota if the user has quota restrictions required: false (optional) + mode := int32(56) // int32 | Mode: * `0` New objects are added, existing ones are updated. This is the default * `1` New objects are added, existing ones are not modified * `2` New objects are added, existing ones are updated and connected users are disconnected and so forced to use the new configuration (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.MaintenanceApi.LoaddataFromFile(context.Background()).InputFile(inputFile).ScanQuota(scanQuota).Mode(mode).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MaintenanceApi.LoaddataFromFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LoaddataFromFile`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `MaintenanceApi.LoaddataFromFile`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiLoaddataFromFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **inputFile** | **string** | Path for the file to read the JSON serialized data from. This can be an absolute path or a path relative to the configured \"backups_path\". The max allowed file size is 10MB | + **scanQuota** | **int32** | Quota scan: * `0` no quota scan is done, the imported users/folders will have used_quota_size and used_quota_files = 0 or the existing values if they already exists. This is the default * `1` scan quota * `2` scan quota if the user has quota restrictions required: false | + **mode** | **int32** | Mode: * `0` New objects are added, existing ones are updated. This is the default * `1` New objects are added, existing ones are not modified * `2` New objects are added, existing ones are updated and connected users are disconnected and so forced to use the new configuration | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LoaddataFromRequestBody + +> ApiResponse LoaddataFromRequestBody(ctx).BackupData(backupData).ScanQuota(scanQuota).Mode(mode).Execute() + +Load data + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + backupData := *openapiclient.NewBackupData() // BackupData | + scanQuota := int32(56) // int32 | Quota scan: * `0` no quota scan is done, the imported users/folders will have used_quota_size and used_quota_files = 0 or the existing values if they already exists. This is the default * `1` scan quota * `2` scan quota if the user has quota restrictions required: false (optional) + mode := int32(56) // int32 | Mode: * `0` New objects are added, existing ones are updated. This is the default * `1` New objects are added, existing ones are not modified * `2` New objects are added, existing ones are updated and connected users are disconnected and so forced to use the new configuration (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.MaintenanceApi.LoaddataFromRequestBody(context.Background()).BackupData(backupData).ScanQuota(scanQuota).Mode(mode).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MaintenanceApi.LoaddataFromRequestBody``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LoaddataFromRequestBody`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `MaintenanceApi.LoaddataFromRequestBody`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiLoaddataFromRequestBodyRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **backupData** | [**BackupData**](BackupData.md) | | + **scanQuota** | **int32** | Quota scan: * `0` no quota scan is done, the imported users/folders will have used_quota_size and used_quota_files = 0 or the existing values if they already exists. This is the default * `1` scan quota * `2` scan quota if the user has quota restrictions required: false | + **mode** | **int32** | Mode: * `0` New objects are added, existing ones are updated. This is the default * `1` New objects are added, existing ones are not modified * `2` New objects are added, existing ones are updated and connected users are disconnected and so forced to use the new configuration | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/MetadataApi.md b/server/common/sftpgo/v2/openapi/docs/MetadataApi.md new file mode 100644 index 00000000..0f0852b2 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/MetadataApi.md @@ -0,0 +1,141 @@ +# \MetadataApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**GetUsersMetadataChecks**](MetadataApi.md#GetUsersMetadataChecks) | **Get** /metadata/users/checks | Get metadata checks +[**StartUserMetadataCheck**](MetadataApi.md#StartUserMetadataCheck) | **Post** /metadata/users/{username}/check | Start a metadata check + + + +## GetUsersMetadataChecks + +> []MetadataCheck GetUsersMetadataChecks(ctx).Execute() + +Get metadata checks + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.MetadataApi.GetUsersMetadataChecks(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MetadataApi.GetUsersMetadataChecks``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUsersMetadataChecks`: []MetadataCheck + fmt.Fprintf(os.Stdout, "Response from `MetadataApi.GetUsersMetadataChecks`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUsersMetadataChecksRequest struct via the builder pattern + + +### Return type + +[**[]MetadataCheck**](MetadataCheck.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## StartUserMetadataCheck + +> ApiResponse StartUserMetadataCheck(ctx, username).Execute() + +Start a metadata check + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.MetadataApi.StartUserMetadataCheck(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MetadataApi.StartUserMetadataCheck``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `StartUserMetadataCheck`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `MetadataApi.StartUserMetadataCheck`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiStartUserMetadataCheckRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/MetadataCheck.md b/server/common/sftpgo/v2/openapi/docs/MetadataCheck.md new file mode 100644 index 00000000..b5d3a27d --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/MetadataCheck.md @@ -0,0 +1,82 @@ +# MetadataCheck + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Username** | Pointer to **string** | username to which the check refers | [optional] +**StartTime** | Pointer to **int64** | check start time as unix timestamp in milliseconds | [optional] + +## Methods + +### NewMetadataCheck + +`func NewMetadataCheck() *MetadataCheck` + +NewMetadataCheck instantiates a new MetadataCheck object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewMetadataCheckWithDefaults + +`func NewMetadataCheckWithDefaults() *MetadataCheck` + +NewMetadataCheckWithDefaults instantiates a new MetadataCheck object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetUsername + +`func (o *MetadataCheck) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *MetadataCheck) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *MetadataCheck) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *MetadataCheck) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetStartTime + +`func (o *MetadataCheck) GetStartTime() int64` + +GetStartTime returns the StartTime field if non-nil, zero value otherwise. + +### GetStartTimeOk + +`func (o *MetadataCheck) GetStartTimeOk() (*int64, bool)` + +GetStartTimeOk returns a tuple with the StartTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStartTime + +`func (o *MetadataCheck) SetStartTime(v int64)` + +SetStartTime sets StartTime field to given value. + +### HasStartTime + +`func (o *MetadataCheck) HasStartTime() bool` + +HasStartTime returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/PatternsFilter.md b/server/common/sftpgo/v2/openapi/docs/PatternsFilter.md new file mode 100644 index 00000000..dc6541fa --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/PatternsFilter.md @@ -0,0 +1,134 @@ +# PatternsFilter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Path** | Pointer to **string** | exposed virtual path, if no other specific filter is defined, the filter applies for sub directories too. For example if filters are defined for the paths \"/\" and \"/sub\" then the filters for \"/\" are applied for any file outside the \"/sub\" directory | [optional] +**AllowedPatterns** | Pointer to **[]string** | list of, case insensitive, allowed shell like patterns. | [optional] +**DeniedPatterns** | Pointer to **[]string** | list of, case insensitive, denied shell like patterns. Denied patterns are evaluated before the allowed ones | [optional] +**DenyPolicy** | Pointer to **int32** | Deny policies * `0` - default policy. Denied files/directories matching the filters are visible in directory listing but cannot be uploaded/downloaded/overwritten/renamed * `1` - deny policy hide. This policy applies the same restrictions as the default one and denied files/directories matching the filters will also be hidden in directory listing. This mode may cause performance issues for large directories | [optional] + +## Methods + +### NewPatternsFilter + +`func NewPatternsFilter() *PatternsFilter` + +NewPatternsFilter instantiates a new PatternsFilter object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewPatternsFilterWithDefaults + +`func NewPatternsFilterWithDefaults() *PatternsFilter` + +NewPatternsFilterWithDefaults instantiates a new PatternsFilter object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetPath + +`func (o *PatternsFilter) GetPath() string` + +GetPath returns the Path field if non-nil, zero value otherwise. + +### GetPathOk + +`func (o *PatternsFilter) GetPathOk() (*string, bool)` + +GetPathOk returns a tuple with the Path field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPath + +`func (o *PatternsFilter) SetPath(v string)` + +SetPath sets Path field to given value. + +### HasPath + +`func (o *PatternsFilter) HasPath() bool` + +HasPath returns a boolean if a field has been set. + +### GetAllowedPatterns + +`func (o *PatternsFilter) GetAllowedPatterns() []string` + +GetAllowedPatterns returns the AllowedPatterns field if non-nil, zero value otherwise. + +### GetAllowedPatternsOk + +`func (o *PatternsFilter) GetAllowedPatternsOk() (*[]string, bool)` + +GetAllowedPatternsOk returns a tuple with the AllowedPatterns field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAllowedPatterns + +`func (o *PatternsFilter) SetAllowedPatterns(v []string)` + +SetAllowedPatterns sets AllowedPatterns field to given value. + +### HasAllowedPatterns + +`func (o *PatternsFilter) HasAllowedPatterns() bool` + +HasAllowedPatterns returns a boolean if a field has been set. + +### GetDeniedPatterns + +`func (o *PatternsFilter) GetDeniedPatterns() []string` + +GetDeniedPatterns returns the DeniedPatterns field if non-nil, zero value otherwise. + +### GetDeniedPatternsOk + +`func (o *PatternsFilter) GetDeniedPatternsOk() (*[]string, bool)` + +GetDeniedPatternsOk returns a tuple with the DeniedPatterns field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeniedPatterns + +`func (o *PatternsFilter) SetDeniedPatterns(v []string)` + +SetDeniedPatterns sets DeniedPatterns field to given value. + +### HasDeniedPatterns + +`func (o *PatternsFilter) HasDeniedPatterns() bool` + +HasDeniedPatterns returns a boolean if a field has been set. + +### GetDenyPolicy + +`func (o *PatternsFilter) GetDenyPolicy() int32` + +GetDenyPolicy returns the DenyPolicy field if non-nil, zero value otherwise. + +### GetDenyPolicyOk + +`func (o *PatternsFilter) GetDenyPolicyOk() (*int32, bool)` + +GetDenyPolicyOk returns a tuple with the DenyPolicy field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDenyPolicy + +`func (o *PatternsFilter) SetDenyPolicy(v int32)` + +SetDenyPolicy sets DenyPolicy field to given value. + +### HasDenyPolicy + +`func (o *PatternsFilter) HasDenyPolicy() bool` + +HasDenyPolicy returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/Permission.md b/server/common/sftpgo/v2/openapi/docs/Permission.md new file mode 100644 index 00000000..0879bcac --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/Permission.md @@ -0,0 +1,41 @@ +# Permission + +## Enum + + +* `STAR` (value: `"*"`) + +* `LIST` (value: `"list"`) + +* `DOWNLOAD` (value: `"download"`) + +* `UPLOAD` (value: `"upload"`) + +* `OVERWRITE` (value: `"overwrite"`) + +* `DELETE` (value: `"delete"`) + +* `DELETE_FILES` (value: `"delete_files"`) + +* `DELETE_DIRS` (value: `"delete_dirs"`) + +* `RENAME` (value: `"rename"`) + +* `RENAME_FILES` (value: `"rename_files"`) + +* `RENAME_DIRS` (value: `"rename_dirs"`) + +* `CREATE_DIRS` (value: `"create_dirs"`) + +* `CREATE_SYMLINKS` (value: `"create_symlinks"`) + +* `CHMOD` (value: `"chmod"`) + +* `CHOWN` (value: `"chown"`) + +* `CHTIMES` (value: `"chtimes"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/ProviderEvent.md b/server/common/sftpgo/v2/openapi/docs/ProviderEvent.md new file mode 100644 index 00000000..232b5d2a --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/ProviderEvent.md @@ -0,0 +1,238 @@ +# ProviderEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] +**Timestamp** | Pointer to **int64** | unix timestamp in nanoseconds | [optional] +**Action** | Pointer to [**ProviderEventAction**](ProviderEventAction.md) | | [optional] +**Username** | Pointer to **string** | | [optional] +**Ip** | Pointer to **string** | | [optional] +**ObjectType** | Pointer to [**ProviderEventObjectType**](ProviderEventObjectType.md) | | [optional] +**ObjectName** | Pointer to **string** | | [optional] +**InstanceId** | Pointer to **string** | | [optional] + +## Methods + +### NewProviderEvent + +`func NewProviderEvent() *ProviderEvent` + +NewProviderEvent instantiates a new ProviderEvent object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewProviderEventWithDefaults + +`func NewProviderEventWithDefaults() *ProviderEvent` + +NewProviderEventWithDefaults instantiates a new ProviderEvent object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *ProviderEvent) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *ProviderEvent) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *ProviderEvent) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *ProviderEvent) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetTimestamp + +`func (o *ProviderEvent) GetTimestamp() int64` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *ProviderEvent) GetTimestampOk() (*int64, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *ProviderEvent) SetTimestamp(v int64)` + +SetTimestamp sets Timestamp field to given value. + +### HasTimestamp + +`func (o *ProviderEvent) HasTimestamp() bool` + +HasTimestamp returns a boolean if a field has been set. + +### GetAction + +`func (o *ProviderEvent) GetAction() ProviderEventAction` + +GetAction returns the Action field if non-nil, zero value otherwise. + +### GetActionOk + +`func (o *ProviderEvent) GetActionOk() (*ProviderEventAction, bool)` + +GetActionOk returns a tuple with the Action field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAction + +`func (o *ProviderEvent) SetAction(v ProviderEventAction)` + +SetAction sets Action field to given value. + +### HasAction + +`func (o *ProviderEvent) HasAction() bool` + +HasAction returns a boolean if a field has been set. + +### GetUsername + +`func (o *ProviderEvent) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *ProviderEvent) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *ProviderEvent) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *ProviderEvent) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetIp + +`func (o *ProviderEvent) GetIp() string` + +GetIp returns the Ip field if non-nil, zero value otherwise. + +### GetIpOk + +`func (o *ProviderEvent) GetIpOk() (*string, bool)` + +GetIpOk returns a tuple with the Ip field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIp + +`func (o *ProviderEvent) SetIp(v string)` + +SetIp sets Ip field to given value. + +### HasIp + +`func (o *ProviderEvent) HasIp() bool` + +HasIp returns a boolean if a field has been set. + +### GetObjectType + +`func (o *ProviderEvent) GetObjectType() ProviderEventObjectType` + +GetObjectType returns the ObjectType field if non-nil, zero value otherwise. + +### GetObjectTypeOk + +`func (o *ProviderEvent) GetObjectTypeOk() (*ProviderEventObjectType, bool)` + +GetObjectTypeOk returns a tuple with the ObjectType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObjectType + +`func (o *ProviderEvent) SetObjectType(v ProviderEventObjectType)` + +SetObjectType sets ObjectType field to given value. + +### HasObjectType + +`func (o *ProviderEvent) HasObjectType() bool` + +HasObjectType returns a boolean if a field has been set. + +### GetObjectName + +`func (o *ProviderEvent) GetObjectName() string` + +GetObjectName returns the ObjectName field if non-nil, zero value otherwise. + +### GetObjectNameOk + +`func (o *ProviderEvent) GetObjectNameOk() (*string, bool)` + +GetObjectNameOk returns a tuple with the ObjectName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObjectName + +`func (o *ProviderEvent) SetObjectName(v string)` + +SetObjectName sets ObjectName field to given value. + +### HasObjectName + +`func (o *ProviderEvent) HasObjectName() bool` + +HasObjectName returns a boolean if a field has been set. + +### GetInstanceId + +`func (o *ProviderEvent) GetInstanceId() string` + +GetInstanceId returns the InstanceId field if non-nil, zero value otherwise. + +### GetInstanceIdOk + +`func (o *ProviderEvent) GetInstanceIdOk() (*string, bool)` + +GetInstanceIdOk returns a tuple with the InstanceId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInstanceId + +`func (o *ProviderEvent) SetInstanceId(v string)` + +SetInstanceId sets InstanceId field to given value. + +### HasInstanceId + +`func (o *ProviderEvent) HasInstanceId() bool` + +HasInstanceId returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/ProviderEventAction.md b/server/common/sftpgo/v2/openapi/docs/ProviderEventAction.md new file mode 100644 index 00000000..a36c3eff --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/ProviderEventAction.md @@ -0,0 +1,15 @@ +# ProviderEventAction + +## Enum + + +* `ADD` (value: `"add"`) + +* `UPDATE` (value: `"update"`) + +* `DELETE` (value: `"delete"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/ProviderEventObjectType.md b/server/common/sftpgo/v2/openapi/docs/ProviderEventObjectType.md new file mode 100644 index 00000000..1ea04e4d --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/ProviderEventObjectType.md @@ -0,0 +1,17 @@ +# ProviderEventObjectType + +## Enum + + +* `USER` (value: `"user"`) + +* `ADMIN` (value: `"admin"`) + +* `API_KEY` (value: `"api_key"`) + +* `SHARE` (value: `"share"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/PublicSharesApi.md b/server/common/sftpgo/v2/openapi/docs/PublicSharesApi.md new file mode 100644 index 00000000..04dd5337 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/PublicSharesApi.md @@ -0,0 +1,380 @@ +# \PublicSharesApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**DownloadShareFile**](PublicSharesApi.md#DownloadShareFile) | **Get** /shares/{id}/files | Download a single file +[**GetShare**](PublicSharesApi.md#GetShare) | **Get** /shares/{id} | Download shared files and folders as a single zip file +[**GetShareDirContents**](PublicSharesApi.md#GetShareDirContents) | **Get** /shares/{id}/dirs | Read directory contents +[**UploadSingleToShare**](PublicSharesApi.md#UploadSingleToShare) | **Post** /shares/{id}/{fileName} | Upload a single file to the shared path +[**UploadToShare**](PublicSharesApi.md#UploadToShare) | **Post** /shares/{id} | Upload one or more files to the shared path + + + +## DownloadShareFile + +> *os.File DownloadShareFile(ctx, id).Path(path).Inline(inline).Execute() + +Download a single file + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | the share id + path := "path_example" // string | Path to the file to download. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" + inline := "inline_example" // string | If set, the response will not have the Content-Disposition header set to `attachment` (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PublicSharesApi.DownloadShareFile(context.Background(), id).Path(path).Inline(inline).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PublicSharesApi.DownloadShareFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DownloadShareFile`: *os.File + fmt.Fprintf(os.Stdout, "Response from `PublicSharesApi.DownloadShareFile`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | the share id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDownloadShareFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **path** | **string** | Path to the file to download. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" | + **inline** | **string** | If set, the response will not have the Content-Disposition header set to `attachment` | + +### Return type + +[***os.File**](*os.File.md) + +### Authorization + +[BasicAuth](../README.md#BasicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */*, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetShare + +> *os.File GetShare(ctx, id).Compress(compress).Execute() + +Download shared files and folders as a single zip file + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | the share id + compress := true // bool | (optional) (default to true) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PublicSharesApi.GetShare(context.Background(), id).Compress(compress).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PublicSharesApi.GetShare``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetShare`: *os.File + fmt.Fprintf(os.Stdout, "Response from `PublicSharesApi.GetShare`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | the share id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetShareRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **compress** | **bool** | | [default to true] + +### Return type + +[***os.File**](*os.File.md) + +### Authorization + +[BasicAuth](../README.md#BasicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */*, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetShareDirContents + +> []DirEntry GetShareDirContents(ctx, id).Path(path).Execute() + +Read directory contents + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | the share id + path := "path_example" // string | Path to the folder to read. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root folder is assumed (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PublicSharesApi.GetShareDirContents(context.Background(), id).Path(path).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PublicSharesApi.GetShareDirContents``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetShareDirContents`: []DirEntry + fmt.Fprintf(os.Stdout, "Response from `PublicSharesApi.GetShareDirContents`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | the share id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetShareDirContentsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **path** | **string** | Path to the folder to read. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root folder is assumed | + +### Return type + +[**[]DirEntry**](DirEntry.md) + +### Authorization + +[BasicAuth](../README.md#BasicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UploadSingleToShare + +> []ApiResponse UploadSingleToShare(ctx, id, fileName).Body(body).XSFTPGOMTIME(xSFTPGOMTIME).Execute() + +Upload a single file to the shared path + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | the share id + fileName := "fileName_example" // string | the name of the new file. It must be path encoded. Sub directories are not accepted + body := os.NewFile(1234, "some_file") // *os.File | + xSFTPGOMTIME := int32(56) // int32 | File modification time as unix timestamp in milliseconds (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PublicSharesApi.UploadSingleToShare(context.Background(), id, fileName).Body(body).XSFTPGOMTIME(xSFTPGOMTIME).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PublicSharesApi.UploadSingleToShare``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UploadSingleToShare`: []ApiResponse + fmt.Fprintf(os.Stdout, "Response from `PublicSharesApi.UploadSingleToShare`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | the share id | +**fileName** | **string** | the name of the new file. It must be path encoded. Sub directories are not accepted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUploadSingleToShareRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + **body** | ***os.File** | | + **xSFTPGOMTIME** | **int32** | File modification time as unix timestamp in milliseconds | + +### Return type + +[**[]ApiResponse**](ApiResponse.md) + +### Authorization + +[BasicAuth](../README.md#BasicAuth) + +### HTTP request headers + +- **Content-Type**: application/_*, text/_*, image/_*, audio/_*, video/_* +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UploadToShare + +> []ApiResponse UploadToShare(ctx, id).Filenames(filenames).Execute() + +Upload one or more files to the shared path + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | the share id + filenames := []*os.File{"TODO"} // []*os.File | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PublicSharesApi.UploadToShare(context.Background(), id).Filenames(filenames).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PublicSharesApi.UploadToShare``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UploadToShare`: []ApiResponse + fmt.Fprintf(os.Stdout, "Response from `PublicSharesApi.UploadToShare`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | the share id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUploadToShareRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **filenames** | **[]*os.File** | | + +### Return type + +[**[]ApiResponse**](ApiResponse.md) + +### Authorization + +[BasicAuth](../README.md#BasicAuth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/PwdChange.md b/server/common/sftpgo/v2/openapi/docs/PwdChange.md new file mode 100644 index 00000000..669f044f --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/PwdChange.md @@ -0,0 +1,82 @@ +# PwdChange + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**CurrentPassword** | Pointer to **string** | | [optional] +**NewPassword** | Pointer to **string** | | [optional] + +## Methods + +### NewPwdChange + +`func NewPwdChange() *PwdChange` + +NewPwdChange instantiates a new PwdChange object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewPwdChangeWithDefaults + +`func NewPwdChangeWithDefaults() *PwdChange` + +NewPwdChangeWithDefaults instantiates a new PwdChange object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetCurrentPassword + +`func (o *PwdChange) GetCurrentPassword() string` + +GetCurrentPassword returns the CurrentPassword field if non-nil, zero value otherwise. + +### GetCurrentPasswordOk + +`func (o *PwdChange) GetCurrentPasswordOk() (*string, bool)` + +GetCurrentPasswordOk returns a tuple with the CurrentPassword field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCurrentPassword + +`func (o *PwdChange) SetCurrentPassword(v string)` + +SetCurrentPassword sets CurrentPassword field to given value. + +### HasCurrentPassword + +`func (o *PwdChange) HasCurrentPassword() bool` + +HasCurrentPassword returns a boolean if a field has been set. + +### GetNewPassword + +`func (o *PwdChange) GetNewPassword() string` + +GetNewPassword returns the NewPassword field if non-nil, zero value otherwise. + +### GetNewPasswordOk + +`func (o *PwdChange) GetNewPasswordOk() (*string, bool)` + +GetNewPasswordOk returns a tuple with the NewPassword field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNewPassword + +`func (o *PwdChange) SetNewPassword(v string)` + +SetNewPassword sets NewPassword field to given value. + +### HasNewPassword + +`func (o *PwdChange) HasNewPassword() bool` + +HasNewPassword returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/QuotaApi.md b/server/common/sftpgo/v2/openapi/docs/QuotaApi.md new file mode 100644 index 00000000..23732c6d --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/QuotaApi.md @@ -0,0 +1,895 @@ +# \QuotaApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**FolderQuotaUpdateUsage**](QuotaApi.md#FolderQuotaUpdateUsage) | **Put** /quotas/folders/{name}/usage | Update folder quota usage limits +[**FolderQuotaUpdateUsageDeprecated**](QuotaApi.md#FolderQuotaUpdateUsageDeprecated) | **Put** /folder-quota-update | Update folder quota limits +[**GetFoldersQuotaScans**](QuotaApi.md#GetFoldersQuotaScans) | **Get** /quotas/folders/scans | Get active folder quota scans +[**GetFoldersQuotaScansDeprecated**](QuotaApi.md#GetFoldersQuotaScansDeprecated) | **Get** /folder-quota-scans | Get folders quota scans +[**GetUsersQuotaScans**](QuotaApi.md#GetUsersQuotaScans) | **Get** /quotas/users/scans | Get active user quota scans +[**GetUsersQuotaScansDeprecated**](QuotaApi.md#GetUsersQuotaScansDeprecated) | **Get** /quota-scans | Get quota scans +[**StartFolderQuotaScan**](QuotaApi.md#StartFolderQuotaScan) | **Post** /quotas/folders/{name}/scan | Start a folder quota scan +[**StartFolderQuotaScanDeprecated**](QuotaApi.md#StartFolderQuotaScanDeprecated) | **Post** /folder-quota-scans | Start a folder quota scan +[**StartUserQuotaScan**](QuotaApi.md#StartUserQuotaScan) | **Post** /quotas/users/{username}/scan | Start a user quota scan +[**StartUserQuotaScanDeprecated**](QuotaApi.md#StartUserQuotaScanDeprecated) | **Post** /quota-scans | Start user quota scan +[**UserQuotaUpdateUsage**](QuotaApi.md#UserQuotaUpdateUsage) | **Put** /quotas/users/{username}/usage | Update disk quota usage limits +[**UserQuotaUpdateUsageDeprecated**](QuotaApi.md#UserQuotaUpdateUsageDeprecated) | **Put** /quota-update | Update quota usage limits +[**UserTransferQuotaUpdateUsage**](QuotaApi.md#UserTransferQuotaUpdateUsage) | **Put** /quotas/users/{username}/transfer-usage | Update transfer quota usage limits + + + +## FolderQuotaUpdateUsage + +> ApiResponse FolderQuotaUpdateUsage(ctx, name).QuotaUsage(quotaUsage).Mode(mode).Execute() + +Update folder quota usage limits + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + name := "name_example" // string | folder name + quotaUsage := *openapiclient.NewQuotaUsage() // QuotaUsage | If used_quota_size and used_quota_files are missing they will default to 0, this means that if mode is \"add\" the current value, for the missing field, will remain unchanged, if mode is \"reset\" the missing field is set to 0 + mode := "reset" // string | the update mode specifies if the given quota usage values should be added or replace the current ones (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.FolderQuotaUpdateUsage(context.Background(), name).QuotaUsage(quotaUsage).Mode(mode).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.FolderQuotaUpdateUsage``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FolderQuotaUpdateUsage`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.FolderQuotaUpdateUsage`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**name** | **string** | folder name | + +### Other Parameters + +Other parameters are passed through a pointer to a apiFolderQuotaUpdateUsageRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **quotaUsage** | [**QuotaUsage**](QuotaUsage.md) | If used_quota_size and used_quota_files are missing they will default to 0, this means that if mode is \"add\" the current value, for the missing field, will remain unchanged, if mode is \"reset\" the missing field is set to 0 | + **mode** | **string** | the update mode specifies if the given quota usage values should be added or replace the current ones | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FolderQuotaUpdateUsageDeprecated + +> ApiResponse FolderQuotaUpdateUsageDeprecated(ctx).BaseVirtualFolder(baseVirtualFolder).Mode(mode).Execute() + +Update folder quota limits + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + baseVirtualFolder := *openapiclient.NewBaseVirtualFolder() // BaseVirtualFolder | The only folder mandatory fields are mapped_path,used_quota_size and used_quota_files. Please note that if the used quota fields are missing they will default to 0, this means that if mode is \"add\" the current value will remain unchanged, if mode is \"reset\" the missing field is set to 0 + mode := "reset" // string | the update mode specifies if the given quota usage values should be added or replace the current ones (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.FolderQuotaUpdateUsageDeprecated(context.Background()).BaseVirtualFolder(baseVirtualFolder).Mode(mode).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.FolderQuotaUpdateUsageDeprecated``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FolderQuotaUpdateUsageDeprecated`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.FolderQuotaUpdateUsageDeprecated`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFolderQuotaUpdateUsageDeprecatedRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **baseVirtualFolder** | [**BaseVirtualFolder**](BaseVirtualFolder.md) | The only folder mandatory fields are mapped_path,used_quota_size and used_quota_files. Please note that if the used quota fields are missing they will default to 0, this means that if mode is \"add\" the current value will remain unchanged, if mode is \"reset\" the missing field is set to 0 | + **mode** | **string** | the update mode specifies if the given quota usage values should be added or replace the current ones | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetFoldersQuotaScans + +> []FolderQuotaScan GetFoldersQuotaScans(ctx).Execute() + +Get active folder quota scans + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.GetFoldersQuotaScans(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.GetFoldersQuotaScans``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetFoldersQuotaScans`: []FolderQuotaScan + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.GetFoldersQuotaScans`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetFoldersQuotaScansRequest struct via the builder pattern + + +### Return type + +[**[]FolderQuotaScan**](FolderQuotaScan.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetFoldersQuotaScansDeprecated + +> []FolderQuotaScan GetFoldersQuotaScansDeprecated(ctx).Execute() + +Get folders quota scans + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.GetFoldersQuotaScansDeprecated(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.GetFoldersQuotaScansDeprecated``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetFoldersQuotaScansDeprecated`: []FolderQuotaScan + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.GetFoldersQuotaScansDeprecated`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetFoldersQuotaScansDeprecatedRequest struct via the builder pattern + + +### Return type + +[**[]FolderQuotaScan**](FolderQuotaScan.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUsersQuotaScans + +> []QuotaScan GetUsersQuotaScans(ctx).Execute() + +Get active user quota scans + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.GetUsersQuotaScans(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.GetUsersQuotaScans``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUsersQuotaScans`: []QuotaScan + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.GetUsersQuotaScans`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUsersQuotaScansRequest struct via the builder pattern + + +### Return type + +[**[]QuotaScan**](QuotaScan.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUsersQuotaScansDeprecated + +> []QuotaScan GetUsersQuotaScansDeprecated(ctx).Execute() + +Get quota scans + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.GetUsersQuotaScansDeprecated(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.GetUsersQuotaScansDeprecated``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUsersQuotaScansDeprecated`: []QuotaScan + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.GetUsersQuotaScansDeprecated`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUsersQuotaScansDeprecatedRequest struct via the builder pattern + + +### Return type + +[**[]QuotaScan**](QuotaScan.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## StartFolderQuotaScan + +> ApiResponse StartFolderQuotaScan(ctx, name).Execute() + +Start a folder quota scan + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + name := "name_example" // string | folder name + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.StartFolderQuotaScan(context.Background(), name).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.StartFolderQuotaScan``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `StartFolderQuotaScan`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.StartFolderQuotaScan`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**name** | **string** | folder name | + +### Other Parameters + +Other parameters are passed through a pointer to a apiStartFolderQuotaScanRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## StartFolderQuotaScanDeprecated + +> ApiResponse StartFolderQuotaScanDeprecated(ctx).BaseVirtualFolder(baseVirtualFolder).Execute() + +Start a folder quota scan + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + baseVirtualFolder := *openapiclient.NewBaseVirtualFolder() // BaseVirtualFolder | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.StartFolderQuotaScanDeprecated(context.Background()).BaseVirtualFolder(baseVirtualFolder).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.StartFolderQuotaScanDeprecated``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `StartFolderQuotaScanDeprecated`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.StartFolderQuotaScanDeprecated`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiStartFolderQuotaScanDeprecatedRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **baseVirtualFolder** | [**BaseVirtualFolder**](BaseVirtualFolder.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## StartUserQuotaScan + +> ApiResponse StartUserQuotaScan(ctx, username).Execute() + +Start a user quota scan + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.StartUserQuotaScan(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.StartUserQuotaScan``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `StartUserQuotaScan`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.StartUserQuotaScan`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiStartUserQuotaScanRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## StartUserQuotaScanDeprecated + +> ApiResponse StartUserQuotaScanDeprecated(ctx).User(user).Execute() + +Start user quota scan + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + user := *openapiclient.NewUser() // User | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.StartUserQuotaScanDeprecated(context.Background()).User(user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.StartUserQuotaScanDeprecated``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `StartUserQuotaScanDeprecated`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.StartUserQuotaScanDeprecated`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiStartUserQuotaScanDeprecatedRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UserQuotaUpdateUsage + +> ApiResponse UserQuotaUpdateUsage(ctx, username).QuotaUsage(quotaUsage).Mode(mode).Execute() + +Update disk quota usage limits + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the username + quotaUsage := *openapiclient.NewQuotaUsage() // QuotaUsage | If used_quota_size and used_quota_files are missing they will default to 0, this means that if mode is \"add\" the current value, for the missing field, will remain unchanged, if mode is \"reset\" the missing field is set to 0 + mode := "reset" // string | the update mode specifies if the given quota usage values should be added or replace the current ones (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.UserQuotaUpdateUsage(context.Background(), username).QuotaUsage(quotaUsage).Mode(mode).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.UserQuotaUpdateUsage``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UserQuotaUpdateUsage`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.UserQuotaUpdateUsage`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUserQuotaUpdateUsageRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **quotaUsage** | [**QuotaUsage**](QuotaUsage.md) | If used_quota_size and used_quota_files are missing they will default to 0, this means that if mode is \"add\" the current value, for the missing field, will remain unchanged, if mode is \"reset\" the missing field is set to 0 | + **mode** | **string** | the update mode specifies if the given quota usage values should be added or replace the current ones | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UserQuotaUpdateUsageDeprecated + +> ApiResponse UserQuotaUpdateUsageDeprecated(ctx).User(user).Mode(mode).Execute() + +Update quota usage limits + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + user := *openapiclient.NewUser() // User | The only user mandatory fields are username, used_quota_size and used_quota_files. Please note that if the quota fields are missing they will default to 0, this means that if mode is \"add\" the current value will remain unchanged, if mode is \"reset\" the missing field is set to 0 + mode := "reset" // string | the update mode specifies if the given quota usage values should be added or replace the current ones (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.UserQuotaUpdateUsageDeprecated(context.Background()).User(user).Mode(mode).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.UserQuotaUpdateUsageDeprecated``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UserQuotaUpdateUsageDeprecated`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.UserQuotaUpdateUsageDeprecated`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiUserQuotaUpdateUsageDeprecatedRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md) | The only user mandatory fields are username, used_quota_size and used_quota_files. Please note that if the quota fields are missing they will default to 0, this means that if mode is \"add\" the current value will remain unchanged, if mode is \"reset\" the missing field is set to 0 | + **mode** | **string** | the update mode specifies if the given quota usage values should be added or replace the current ones | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UserTransferQuotaUpdateUsage + +> ApiResponse UserTransferQuotaUpdateUsage(ctx, username).TransferQuotaUsage(transferQuotaUsage).Mode(mode).Execute() + +Update transfer quota usage limits + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the username + transferQuotaUsage := *openapiclient.NewTransferQuotaUsage() // TransferQuotaUsage | If used_upload_data_transfer and used_download_data_transfer are missing they will default to 0, this means that if mode is \"add\" the current value, for the missing field, will remain unchanged, if mode is \"reset\" the missing field is set to 0 + mode := "reset" // string | the update mode specifies if the given quota usage values should be added or replace the current ones (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QuotaApi.UserTransferQuotaUpdateUsage(context.Background(), username).TransferQuotaUsage(transferQuotaUsage).Mode(mode).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QuotaApi.UserTransferQuotaUpdateUsage``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UserTransferQuotaUpdateUsage`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `QuotaApi.UserTransferQuotaUpdateUsage`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUserTransferQuotaUpdateUsageRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **transferQuotaUsage** | [**TransferQuotaUsage**](TransferQuotaUsage.md) | If used_upload_data_transfer and used_download_data_transfer are missing they will default to 0, this means that if mode is \"add\" the current value, for the missing field, will remain unchanged, if mode is \"reset\" the missing field is set to 0 | + **mode** | **string** | the update mode specifies if the given quota usage values should be added or replace the current ones | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/QuotaScan.md b/server/common/sftpgo/v2/openapi/docs/QuotaScan.md new file mode 100644 index 00000000..0d32e476 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/QuotaScan.md @@ -0,0 +1,82 @@ +# QuotaScan + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Username** | Pointer to **string** | username to which the quota scan refers | [optional] +**StartTime** | Pointer to **int64** | scan start time as unix timestamp in milliseconds | [optional] + +## Methods + +### NewQuotaScan + +`func NewQuotaScan() *QuotaScan` + +NewQuotaScan instantiates a new QuotaScan object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewQuotaScanWithDefaults + +`func NewQuotaScanWithDefaults() *QuotaScan` + +NewQuotaScanWithDefaults instantiates a new QuotaScan object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetUsername + +`func (o *QuotaScan) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *QuotaScan) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *QuotaScan) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *QuotaScan) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetStartTime + +`func (o *QuotaScan) GetStartTime() int64` + +GetStartTime returns the StartTime field if non-nil, zero value otherwise. + +### GetStartTimeOk + +`func (o *QuotaScan) GetStartTimeOk() (*int64, bool)` + +GetStartTimeOk returns a tuple with the StartTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStartTime + +`func (o *QuotaScan) SetStartTime(v int64)` + +SetStartTime sets StartTime field to given value. + +### HasStartTime + +`func (o *QuotaScan) HasStartTime() bool` + +HasStartTime returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/QuotaUsage.md b/server/common/sftpgo/v2/openapi/docs/QuotaUsage.md new file mode 100644 index 00000000..51ae95a6 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/QuotaUsage.md @@ -0,0 +1,82 @@ +# QuotaUsage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**UsedQuotaSize** | Pointer to **int64** | | [optional] +**UsedQuotaFiles** | Pointer to **int32** | | [optional] + +## Methods + +### NewQuotaUsage + +`func NewQuotaUsage() *QuotaUsage` + +NewQuotaUsage instantiates a new QuotaUsage object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewQuotaUsageWithDefaults + +`func NewQuotaUsageWithDefaults() *QuotaUsage` + +NewQuotaUsageWithDefaults instantiates a new QuotaUsage object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetUsedQuotaSize + +`func (o *QuotaUsage) GetUsedQuotaSize() int64` + +GetUsedQuotaSize returns the UsedQuotaSize field if non-nil, zero value otherwise. + +### GetUsedQuotaSizeOk + +`func (o *QuotaUsage) GetUsedQuotaSizeOk() (*int64, bool)` + +GetUsedQuotaSizeOk returns a tuple with the UsedQuotaSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedQuotaSize + +`func (o *QuotaUsage) SetUsedQuotaSize(v int64)` + +SetUsedQuotaSize sets UsedQuotaSize field to given value. + +### HasUsedQuotaSize + +`func (o *QuotaUsage) HasUsedQuotaSize() bool` + +HasUsedQuotaSize returns a boolean if a field has been set. + +### GetUsedQuotaFiles + +`func (o *QuotaUsage) GetUsedQuotaFiles() int32` + +GetUsedQuotaFiles returns the UsedQuotaFiles field if non-nil, zero value otherwise. + +### GetUsedQuotaFilesOk + +`func (o *QuotaUsage) GetUsedQuotaFilesOk() (*int32, bool)` + +GetUsedQuotaFilesOk returns a tuple with the UsedQuotaFiles field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedQuotaFiles + +`func (o *QuotaUsage) SetUsedQuotaFiles(v int32)` + +SetUsedQuotaFiles sets UsedQuotaFiles field to given value. + +### HasUsedQuotaFiles + +`func (o *QuotaUsage) HasUsedQuotaFiles() bool` + +HasUsedQuotaFiles returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/RecoveryCode.md b/server/common/sftpgo/v2/openapi/docs/RecoveryCode.md new file mode 100644 index 00000000..3cb09256 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/RecoveryCode.md @@ -0,0 +1,82 @@ +# RecoveryCode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Secret** | Pointer to [**Secret**](Secret.md) | | [optional] +**Used** | Pointer to **bool** | | [optional] + +## Methods + +### NewRecoveryCode + +`func NewRecoveryCode() *RecoveryCode` + +NewRecoveryCode instantiates a new RecoveryCode object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewRecoveryCodeWithDefaults + +`func NewRecoveryCodeWithDefaults() *RecoveryCode` + +NewRecoveryCodeWithDefaults instantiates a new RecoveryCode object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetSecret + +`func (o *RecoveryCode) GetSecret() Secret` + +GetSecret returns the Secret field if non-nil, zero value otherwise. + +### GetSecretOk + +`func (o *RecoveryCode) GetSecretOk() (*Secret, bool)` + +GetSecretOk returns a tuple with the Secret field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSecret + +`func (o *RecoveryCode) SetSecret(v Secret)` + +SetSecret sets Secret field to given value. + +### HasSecret + +`func (o *RecoveryCode) HasSecret() bool` + +HasSecret returns a boolean if a field has been set. + +### GetUsed + +`func (o *RecoveryCode) GetUsed() bool` + +GetUsed returns the Used field if non-nil, zero value otherwise. + +### GetUsedOk + +`func (o *RecoveryCode) GetUsedOk() (*bool, bool)` + +GetUsedOk returns a tuple with the Used field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsed + +`func (o *RecoveryCode) SetUsed(v bool)` + +SetUsed sets Used field to given value. + +### HasUsed + +`func (o *RecoveryCode) HasUsed() bool` + +HasUsed returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/RetentionCheck.md b/server/common/sftpgo/v2/openapi/docs/RetentionCheck.md new file mode 100644 index 00000000..387607bf --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/RetentionCheck.md @@ -0,0 +1,160 @@ +# RetentionCheck + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Username** | Pointer to **string** | username to which the retention check refers | [optional] +**Folders** | Pointer to [**[]FolderRetention**](FolderRetention.md) | | [optional] +**StartTime** | Pointer to **int64** | check start time as unix timestamp in milliseconds | [optional] +**Notifications** | Pointer to [**[]RetentionCheckNotification**](RetentionCheckNotification.md) | | [optional] +**Email** | Pointer to **string** | if the notification method is set to \"Email\", this is the e-mail address that receives the retention check report. This field is automatically set to the email address associated with the administrator starting the check | [optional] + +## Methods + +### NewRetentionCheck + +`func NewRetentionCheck() *RetentionCheck` + +NewRetentionCheck instantiates a new RetentionCheck object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewRetentionCheckWithDefaults + +`func NewRetentionCheckWithDefaults() *RetentionCheck` + +NewRetentionCheckWithDefaults instantiates a new RetentionCheck object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetUsername + +`func (o *RetentionCheck) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *RetentionCheck) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *RetentionCheck) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *RetentionCheck) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetFolders + +`func (o *RetentionCheck) GetFolders() []FolderRetention` + +GetFolders returns the Folders field if non-nil, zero value otherwise. + +### GetFoldersOk + +`func (o *RetentionCheck) GetFoldersOk() (*[]FolderRetention, bool)` + +GetFoldersOk returns a tuple with the Folders field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFolders + +`func (o *RetentionCheck) SetFolders(v []FolderRetention)` + +SetFolders sets Folders field to given value. + +### HasFolders + +`func (o *RetentionCheck) HasFolders() bool` + +HasFolders returns a boolean if a field has been set. + +### GetStartTime + +`func (o *RetentionCheck) GetStartTime() int64` + +GetStartTime returns the StartTime field if non-nil, zero value otherwise. + +### GetStartTimeOk + +`func (o *RetentionCheck) GetStartTimeOk() (*int64, bool)` + +GetStartTimeOk returns a tuple with the StartTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStartTime + +`func (o *RetentionCheck) SetStartTime(v int64)` + +SetStartTime sets StartTime field to given value. + +### HasStartTime + +`func (o *RetentionCheck) HasStartTime() bool` + +HasStartTime returns a boolean if a field has been set. + +### GetNotifications + +`func (o *RetentionCheck) GetNotifications() []RetentionCheckNotification` + +GetNotifications returns the Notifications field if non-nil, zero value otherwise. + +### GetNotificationsOk + +`func (o *RetentionCheck) GetNotificationsOk() (*[]RetentionCheckNotification, bool)` + +GetNotificationsOk returns a tuple with the Notifications field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNotifications + +`func (o *RetentionCheck) SetNotifications(v []RetentionCheckNotification)` + +SetNotifications sets Notifications field to given value. + +### HasNotifications + +`func (o *RetentionCheck) HasNotifications() bool` + +HasNotifications returns a boolean if a field has been set. + +### GetEmail + +`func (o *RetentionCheck) GetEmail() string` + +GetEmail returns the Email field if non-nil, zero value otherwise. + +### GetEmailOk + +`func (o *RetentionCheck) GetEmailOk() (*string, bool)` + +GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEmail + +`func (o *RetentionCheck) SetEmail(v string)` + +SetEmail sets Email field to given value. + +### HasEmail + +`func (o *RetentionCheck) HasEmail() bool` + +HasEmail returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/RetentionCheckNotification.md b/server/common/sftpgo/v2/openapi/docs/RetentionCheckNotification.md new file mode 100644 index 00000000..232d905c --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/RetentionCheckNotification.md @@ -0,0 +1,13 @@ +# RetentionCheckNotification + +## Enum + + +* `HOOK` (value: `"Hook"`) + +* `EMAIL` (value: `"Email"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/S3Config.md b/server/common/sftpgo/v2/openapi/docs/S3Config.md new file mode 100644 index 00000000..fffeedff --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/S3Config.md @@ -0,0 +1,420 @@ +# S3Config + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bucket** | Pointer to **string** | | [optional] +**Region** | Pointer to **string** | | [optional] +**AccessKey** | Pointer to **string** | | [optional] +**AccessSecret** | Pointer to [**Secret**](Secret.md) | | [optional] +**Endpoint** | Pointer to **string** | optional endpoint | [optional] +**StorageClass** | Pointer to **string** | | [optional] +**Acl** | Pointer to **string** | The canned ACL to apply to uploaded objects. Leave empty to use the default ACL. For more information and available ACLs, see here: https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl | [optional] +**UploadPartSize** | Pointer to **int32** | the buffer size (in MB) to use for multipart uploads. The minimum allowed part size is 5MB, and if this value is set to zero, the default value (5MB) for the AWS SDK will be used. The minimum allowed value is 5. | [optional] +**UploadConcurrency** | Pointer to **int32** | the number of parts to upload in parallel. If this value is set to zero, the default value (5) will be used | [optional] +**UploadPartMaxTime** | Pointer to **int32** | the maximum time allowed, in seconds, to upload a single chunk (the chunk size is defined via \"upload_part_size\"). 0 means no timeout | [optional] +**DownloadPartSize** | Pointer to **int32** | the buffer size (in MB) to use for multipart downloads. The minimum allowed part size is 5MB, and if this value is set to zero, the default value (5MB) for the AWS SDK will be used. The minimum allowed value is 5. Ignored for partial downloads | [optional] +**DownloadConcurrency** | Pointer to **int32** | the number of parts to download in parallel. If this value is set to zero, the default value (5) will be used. Ignored for partial downloads | [optional] +**DownloadPartMaxTime** | Pointer to **int32** | the maximum time allowed, in seconds, to download a single chunk (the chunk size is defined via \"download_part_size\"). 0 means no timeout. Ignored for partial downloads. | [optional] +**ForcePathStyle** | Pointer to **bool** | Set this to \"true\" to force the request to use path-style addressing, i.e., \"http://s3.amazonaws.com/BUCKET/KEY\". By default, the S3 client will use virtual hosted bucket addressing when possible (\"http://BUCKET.s3.amazonaws.com/KEY\") | [optional] +**KeyPrefix** | Pointer to **string** | key_prefix is similar to a chroot directory for a local filesystem. If specified the user will only see contents that starts with this prefix and so you can restrict access to a specific virtual folder. The prefix, if not empty, must not start with \"/\" and must end with \"/\". If empty the whole bucket contents will be available | [optional] + +## Methods + +### NewS3Config + +`func NewS3Config() *S3Config` + +NewS3Config instantiates a new S3Config object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewS3ConfigWithDefaults + +`func NewS3ConfigWithDefaults() *S3Config` + +NewS3ConfigWithDefaults instantiates a new S3Config object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBucket + +`func (o *S3Config) GetBucket() string` + +GetBucket returns the Bucket field if non-nil, zero value otherwise. + +### GetBucketOk + +`func (o *S3Config) GetBucketOk() (*string, bool)` + +GetBucketOk returns a tuple with the Bucket field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBucket + +`func (o *S3Config) SetBucket(v string)` + +SetBucket sets Bucket field to given value. + +### HasBucket + +`func (o *S3Config) HasBucket() bool` + +HasBucket returns a boolean if a field has been set. + +### GetRegion + +`func (o *S3Config) GetRegion() string` + +GetRegion returns the Region field if non-nil, zero value otherwise. + +### GetRegionOk + +`func (o *S3Config) GetRegionOk() (*string, bool)` + +GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegion + +`func (o *S3Config) SetRegion(v string)` + +SetRegion sets Region field to given value. + +### HasRegion + +`func (o *S3Config) HasRegion() bool` + +HasRegion returns a boolean if a field has been set. + +### GetAccessKey + +`func (o *S3Config) GetAccessKey() string` + +GetAccessKey returns the AccessKey field if non-nil, zero value otherwise. + +### GetAccessKeyOk + +`func (o *S3Config) GetAccessKeyOk() (*string, bool)` + +GetAccessKeyOk returns a tuple with the AccessKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAccessKey + +`func (o *S3Config) SetAccessKey(v string)` + +SetAccessKey sets AccessKey field to given value. + +### HasAccessKey + +`func (o *S3Config) HasAccessKey() bool` + +HasAccessKey returns a boolean if a field has been set. + +### GetAccessSecret + +`func (o *S3Config) GetAccessSecret() Secret` + +GetAccessSecret returns the AccessSecret field if non-nil, zero value otherwise. + +### GetAccessSecretOk + +`func (o *S3Config) GetAccessSecretOk() (*Secret, bool)` + +GetAccessSecretOk returns a tuple with the AccessSecret field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAccessSecret + +`func (o *S3Config) SetAccessSecret(v Secret)` + +SetAccessSecret sets AccessSecret field to given value. + +### HasAccessSecret + +`func (o *S3Config) HasAccessSecret() bool` + +HasAccessSecret returns a boolean if a field has been set. + +### GetEndpoint + +`func (o *S3Config) GetEndpoint() string` + +GetEndpoint returns the Endpoint field if non-nil, zero value otherwise. + +### GetEndpointOk + +`func (o *S3Config) GetEndpointOk() (*string, bool)` + +GetEndpointOk returns a tuple with the Endpoint field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEndpoint + +`func (o *S3Config) SetEndpoint(v string)` + +SetEndpoint sets Endpoint field to given value. + +### HasEndpoint + +`func (o *S3Config) HasEndpoint() bool` + +HasEndpoint returns a boolean if a field has been set. + +### GetStorageClass + +`func (o *S3Config) GetStorageClass() string` + +GetStorageClass returns the StorageClass field if non-nil, zero value otherwise. + +### GetStorageClassOk + +`func (o *S3Config) GetStorageClassOk() (*string, bool)` + +GetStorageClassOk returns a tuple with the StorageClass field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStorageClass + +`func (o *S3Config) SetStorageClass(v string)` + +SetStorageClass sets StorageClass field to given value. + +### HasStorageClass + +`func (o *S3Config) HasStorageClass() bool` + +HasStorageClass returns a boolean if a field has been set. + +### GetAcl + +`func (o *S3Config) GetAcl() string` + +GetAcl returns the Acl field if non-nil, zero value otherwise. + +### GetAclOk + +`func (o *S3Config) GetAclOk() (*string, bool)` + +GetAclOk returns a tuple with the Acl field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAcl + +`func (o *S3Config) SetAcl(v string)` + +SetAcl sets Acl field to given value. + +### HasAcl + +`func (o *S3Config) HasAcl() bool` + +HasAcl returns a boolean if a field has been set. + +### GetUploadPartSize + +`func (o *S3Config) GetUploadPartSize() int32` + +GetUploadPartSize returns the UploadPartSize field if non-nil, zero value otherwise. + +### GetUploadPartSizeOk + +`func (o *S3Config) GetUploadPartSizeOk() (*int32, bool)` + +GetUploadPartSizeOk returns a tuple with the UploadPartSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUploadPartSize + +`func (o *S3Config) SetUploadPartSize(v int32)` + +SetUploadPartSize sets UploadPartSize field to given value. + +### HasUploadPartSize + +`func (o *S3Config) HasUploadPartSize() bool` + +HasUploadPartSize returns a boolean if a field has been set. + +### GetUploadConcurrency + +`func (o *S3Config) GetUploadConcurrency() int32` + +GetUploadConcurrency returns the UploadConcurrency field if non-nil, zero value otherwise. + +### GetUploadConcurrencyOk + +`func (o *S3Config) GetUploadConcurrencyOk() (*int32, bool)` + +GetUploadConcurrencyOk returns a tuple with the UploadConcurrency field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUploadConcurrency + +`func (o *S3Config) SetUploadConcurrency(v int32)` + +SetUploadConcurrency sets UploadConcurrency field to given value. + +### HasUploadConcurrency + +`func (o *S3Config) HasUploadConcurrency() bool` + +HasUploadConcurrency returns a boolean if a field has been set. + +### GetUploadPartMaxTime + +`func (o *S3Config) GetUploadPartMaxTime() int32` + +GetUploadPartMaxTime returns the UploadPartMaxTime field if non-nil, zero value otherwise. + +### GetUploadPartMaxTimeOk + +`func (o *S3Config) GetUploadPartMaxTimeOk() (*int32, bool)` + +GetUploadPartMaxTimeOk returns a tuple with the UploadPartMaxTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUploadPartMaxTime + +`func (o *S3Config) SetUploadPartMaxTime(v int32)` + +SetUploadPartMaxTime sets UploadPartMaxTime field to given value. + +### HasUploadPartMaxTime + +`func (o *S3Config) HasUploadPartMaxTime() bool` + +HasUploadPartMaxTime returns a boolean if a field has been set. + +### GetDownloadPartSize + +`func (o *S3Config) GetDownloadPartSize() int32` + +GetDownloadPartSize returns the DownloadPartSize field if non-nil, zero value otherwise. + +### GetDownloadPartSizeOk + +`func (o *S3Config) GetDownloadPartSizeOk() (*int32, bool)` + +GetDownloadPartSizeOk returns a tuple with the DownloadPartSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDownloadPartSize + +`func (o *S3Config) SetDownloadPartSize(v int32)` + +SetDownloadPartSize sets DownloadPartSize field to given value. + +### HasDownloadPartSize + +`func (o *S3Config) HasDownloadPartSize() bool` + +HasDownloadPartSize returns a boolean if a field has been set. + +### GetDownloadConcurrency + +`func (o *S3Config) GetDownloadConcurrency() int32` + +GetDownloadConcurrency returns the DownloadConcurrency field if non-nil, zero value otherwise. + +### GetDownloadConcurrencyOk + +`func (o *S3Config) GetDownloadConcurrencyOk() (*int32, bool)` + +GetDownloadConcurrencyOk returns a tuple with the DownloadConcurrency field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDownloadConcurrency + +`func (o *S3Config) SetDownloadConcurrency(v int32)` + +SetDownloadConcurrency sets DownloadConcurrency field to given value. + +### HasDownloadConcurrency + +`func (o *S3Config) HasDownloadConcurrency() bool` + +HasDownloadConcurrency returns a boolean if a field has been set. + +### GetDownloadPartMaxTime + +`func (o *S3Config) GetDownloadPartMaxTime() int32` + +GetDownloadPartMaxTime returns the DownloadPartMaxTime field if non-nil, zero value otherwise. + +### GetDownloadPartMaxTimeOk + +`func (o *S3Config) GetDownloadPartMaxTimeOk() (*int32, bool)` + +GetDownloadPartMaxTimeOk returns a tuple with the DownloadPartMaxTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDownloadPartMaxTime + +`func (o *S3Config) SetDownloadPartMaxTime(v int32)` + +SetDownloadPartMaxTime sets DownloadPartMaxTime field to given value. + +### HasDownloadPartMaxTime + +`func (o *S3Config) HasDownloadPartMaxTime() bool` + +HasDownloadPartMaxTime returns a boolean if a field has been set. + +### GetForcePathStyle + +`func (o *S3Config) GetForcePathStyle() bool` + +GetForcePathStyle returns the ForcePathStyle field if non-nil, zero value otherwise. + +### GetForcePathStyleOk + +`func (o *S3Config) GetForcePathStyleOk() (*bool, bool)` + +GetForcePathStyleOk returns a tuple with the ForcePathStyle field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetForcePathStyle + +`func (o *S3Config) SetForcePathStyle(v bool)` + +SetForcePathStyle sets ForcePathStyle field to given value. + +### HasForcePathStyle + +`func (o *S3Config) HasForcePathStyle() bool` + +HasForcePathStyle returns a boolean if a field has been set. + +### GetKeyPrefix + +`func (o *S3Config) GetKeyPrefix() string` + +GetKeyPrefix returns the KeyPrefix field if non-nil, zero value otherwise. + +### GetKeyPrefixOk + +`func (o *S3Config) GetKeyPrefixOk() (*string, bool)` + +GetKeyPrefixOk returns a tuple with the KeyPrefix field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKeyPrefix + +`func (o *S3Config) SetKeyPrefix(v string)` + +SetKeyPrefix sets KeyPrefix field to given value. + +### HasKeyPrefix + +`func (o *S3Config) HasKeyPrefix() bool` + +HasKeyPrefix returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/SFTPFsConfig.md b/server/common/sftpgo/v2/openapi/docs/SFTPFsConfig.md new file mode 100644 index 00000000..638f7061 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/SFTPFsConfig.md @@ -0,0 +1,238 @@ +# SFTPFsConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Endpoint** | Pointer to **string** | remote SFTP endpoint as host:port | [optional] +**Username** | Pointer to **string** | you can specify a password or private key or both. In the latter case the private key will be tried first. | [optional] +**Password** | Pointer to [**Secret**](Secret.md) | | [optional] +**PrivateKey** | Pointer to [**Secret**](Secret.md) | | [optional] +**Fingerprints** | Pointer to **[]string** | SHA256 fingerprints to use for host key verification. If you don't provide any fingerprint the remote host key will not be verified, this is a security risk | [optional] +**Prefix** | Pointer to **string** | Specifying a prefix you can restrict all operations to a given path within the remote SFTP server. | [optional] +**DisableConcurrentReads** | Pointer to **bool** | Concurrent reads are safe to use and disabling them will degrade performance. Some servers automatically delete files once they are downloaded. Using concurrent reads is problematic with such servers. | [optional] +**BufferSize** | Pointer to **int32** | The size of the buffer (in MB) to use for transfers. By enabling buffering, the reads and writes, from/to the remote SFTP server, are split in multiple concurrent requests and this allows data to be transferred at a faster rate, over high latency networks, by overlapping round-trip times. With buffering enabled, resuming uploads is not supported and a file cannot be opened for both reading and writing at the same time. 0 means disabled. | [optional] + +## Methods + +### NewSFTPFsConfig + +`func NewSFTPFsConfig() *SFTPFsConfig` + +NewSFTPFsConfig instantiates a new SFTPFsConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSFTPFsConfigWithDefaults + +`func NewSFTPFsConfigWithDefaults() *SFTPFsConfig` + +NewSFTPFsConfigWithDefaults instantiates a new SFTPFsConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetEndpoint + +`func (o *SFTPFsConfig) GetEndpoint() string` + +GetEndpoint returns the Endpoint field if non-nil, zero value otherwise. + +### GetEndpointOk + +`func (o *SFTPFsConfig) GetEndpointOk() (*string, bool)` + +GetEndpointOk returns a tuple with the Endpoint field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEndpoint + +`func (o *SFTPFsConfig) SetEndpoint(v string)` + +SetEndpoint sets Endpoint field to given value. + +### HasEndpoint + +`func (o *SFTPFsConfig) HasEndpoint() bool` + +HasEndpoint returns a boolean if a field has been set. + +### GetUsername + +`func (o *SFTPFsConfig) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *SFTPFsConfig) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *SFTPFsConfig) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *SFTPFsConfig) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetPassword + +`func (o *SFTPFsConfig) GetPassword() Secret` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *SFTPFsConfig) GetPasswordOk() (*Secret, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *SFTPFsConfig) SetPassword(v Secret)` + +SetPassword sets Password field to given value. + +### HasPassword + +`func (o *SFTPFsConfig) HasPassword() bool` + +HasPassword returns a boolean if a field has been set. + +### GetPrivateKey + +`func (o *SFTPFsConfig) GetPrivateKey() Secret` + +GetPrivateKey returns the PrivateKey field if non-nil, zero value otherwise. + +### GetPrivateKeyOk + +`func (o *SFTPFsConfig) GetPrivateKeyOk() (*Secret, bool)` + +GetPrivateKeyOk returns a tuple with the PrivateKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrivateKey + +`func (o *SFTPFsConfig) SetPrivateKey(v Secret)` + +SetPrivateKey sets PrivateKey field to given value. + +### HasPrivateKey + +`func (o *SFTPFsConfig) HasPrivateKey() bool` + +HasPrivateKey returns a boolean if a field has been set. + +### GetFingerprints + +`func (o *SFTPFsConfig) GetFingerprints() []string` + +GetFingerprints returns the Fingerprints field if non-nil, zero value otherwise. + +### GetFingerprintsOk + +`func (o *SFTPFsConfig) GetFingerprintsOk() (*[]string, bool)` + +GetFingerprintsOk returns a tuple with the Fingerprints field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFingerprints + +`func (o *SFTPFsConfig) SetFingerprints(v []string)` + +SetFingerprints sets Fingerprints field to given value. + +### HasFingerprints + +`func (o *SFTPFsConfig) HasFingerprints() bool` + +HasFingerprints returns a boolean if a field has been set. + +### GetPrefix + +`func (o *SFTPFsConfig) GetPrefix() string` + +GetPrefix returns the Prefix field if non-nil, zero value otherwise. + +### GetPrefixOk + +`func (o *SFTPFsConfig) GetPrefixOk() (*string, bool)` + +GetPrefixOk returns a tuple with the Prefix field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefix + +`func (o *SFTPFsConfig) SetPrefix(v string)` + +SetPrefix sets Prefix field to given value. + +### HasPrefix + +`func (o *SFTPFsConfig) HasPrefix() bool` + +HasPrefix returns a boolean if a field has been set. + +### GetDisableConcurrentReads + +`func (o *SFTPFsConfig) GetDisableConcurrentReads() bool` + +GetDisableConcurrentReads returns the DisableConcurrentReads field if non-nil, zero value otherwise. + +### GetDisableConcurrentReadsOk + +`func (o *SFTPFsConfig) GetDisableConcurrentReadsOk() (*bool, bool)` + +GetDisableConcurrentReadsOk returns a tuple with the DisableConcurrentReads field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDisableConcurrentReads + +`func (o *SFTPFsConfig) SetDisableConcurrentReads(v bool)` + +SetDisableConcurrentReads sets DisableConcurrentReads field to given value. + +### HasDisableConcurrentReads + +`func (o *SFTPFsConfig) HasDisableConcurrentReads() bool` + +HasDisableConcurrentReads returns a boolean if a field has been set. + +### GetBufferSize + +`func (o *SFTPFsConfig) GetBufferSize() int32` + +GetBufferSize returns the BufferSize field if non-nil, zero value otherwise. + +### GetBufferSizeOk + +`func (o *SFTPFsConfig) GetBufferSizeOk() (*int32, bool)` + +GetBufferSizeOk returns a tuple with the BufferSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBufferSize + +`func (o *SFTPFsConfig) SetBufferSize(v int32)` + +SetBufferSize sets BufferSize field to given value. + +### HasBufferSize + +`func (o *SFTPFsConfig) HasBufferSize() bool` + +HasBufferSize returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/SSHBinding.md b/server/common/sftpgo/v2/openapi/docs/SSHBinding.md new file mode 100644 index 00000000..66f5dcf5 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/SSHBinding.md @@ -0,0 +1,108 @@ +# SSHBinding + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Address** | Pointer to **string** | TCP address the server listen on | [optional] +**Port** | Pointer to **int32** | the port used for serving requests | [optional] +**ApplyProxyConfig** | Pointer to **bool** | apply the proxy configuration, if any | [optional] + +## Methods + +### NewSSHBinding + +`func NewSSHBinding() *SSHBinding` + +NewSSHBinding instantiates a new SSHBinding object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSSHBindingWithDefaults + +`func NewSSHBindingWithDefaults() *SSHBinding` + +NewSSHBindingWithDefaults instantiates a new SSHBinding object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAddress + +`func (o *SSHBinding) GetAddress() string` + +GetAddress returns the Address field if non-nil, zero value otherwise. + +### GetAddressOk + +`func (o *SSHBinding) GetAddressOk() (*string, bool)` + +GetAddressOk returns a tuple with the Address field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAddress + +`func (o *SSHBinding) SetAddress(v string)` + +SetAddress sets Address field to given value. + +### HasAddress + +`func (o *SSHBinding) HasAddress() bool` + +HasAddress returns a boolean if a field has been set. + +### GetPort + +`func (o *SSHBinding) GetPort() int32` + +GetPort returns the Port field if non-nil, zero value otherwise. + +### GetPortOk + +`func (o *SSHBinding) GetPortOk() (*int32, bool)` + +GetPortOk returns a tuple with the Port field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPort + +`func (o *SSHBinding) SetPort(v int32)` + +SetPort sets Port field to given value. + +### HasPort + +`func (o *SSHBinding) HasPort() bool` + +HasPort returns a boolean if a field has been set. + +### GetApplyProxyConfig + +`func (o *SSHBinding) GetApplyProxyConfig() bool` + +GetApplyProxyConfig returns the ApplyProxyConfig field if non-nil, zero value otherwise. + +### GetApplyProxyConfigOk + +`func (o *SSHBinding) GetApplyProxyConfigOk() (*bool, bool)` + +GetApplyProxyConfigOk returns a tuple with the ApplyProxyConfig field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetApplyProxyConfig + +`func (o *SSHBinding) SetApplyProxyConfig(v bool)` + +SetApplyProxyConfig sets ApplyProxyConfig field to given value. + +### HasApplyProxyConfig + +`func (o *SSHBinding) HasApplyProxyConfig() bool` + +HasApplyProxyConfig returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/SSHHostKey.md b/server/common/sftpgo/v2/openapi/docs/SSHHostKey.md new file mode 100644 index 00000000..2fa8164e --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/SSHHostKey.md @@ -0,0 +1,82 @@ +# SSHHostKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Path** | Pointer to **string** | | [optional] +**Fingerprint** | Pointer to **string** | | [optional] + +## Methods + +### NewSSHHostKey + +`func NewSSHHostKey() *SSHHostKey` + +NewSSHHostKey instantiates a new SSHHostKey object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSSHHostKeyWithDefaults + +`func NewSSHHostKeyWithDefaults() *SSHHostKey` + +NewSSHHostKeyWithDefaults instantiates a new SSHHostKey object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetPath + +`func (o *SSHHostKey) GetPath() string` + +GetPath returns the Path field if non-nil, zero value otherwise. + +### GetPathOk + +`func (o *SSHHostKey) GetPathOk() (*string, bool)` + +GetPathOk returns a tuple with the Path field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPath + +`func (o *SSHHostKey) SetPath(v string)` + +SetPath sets Path field to given value. + +### HasPath + +`func (o *SSHHostKey) HasPath() bool` + +HasPath returns a boolean if a field has been set. + +### GetFingerprint + +`func (o *SSHHostKey) GetFingerprint() string` + +GetFingerprint returns the Fingerprint field if non-nil, zero value otherwise. + +### GetFingerprintOk + +`func (o *SSHHostKey) GetFingerprintOk() (*string, bool)` + +GetFingerprintOk returns a tuple with the Fingerprint field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFingerprint + +`func (o *SSHHostKey) SetFingerprint(v string)` + +SetFingerprint sets Fingerprint field to given value. + +### HasFingerprint + +`func (o *SSHHostKey) HasFingerprint() bool` + +HasFingerprint returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/SSHServiceStatus.md b/server/common/sftpgo/v2/openapi/docs/SSHServiceStatus.md new file mode 100644 index 00000000..249e8bfc --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/SSHServiceStatus.md @@ -0,0 +1,154 @@ +# SSHServiceStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**IsActive** | Pointer to **bool** | | [optional] +**Bindings** | Pointer to [**[]SSHBinding**](SSHBinding.md) | | [optional] +**HostKeys** | Pointer to [**[]SSHHostKey**](SSHHostKey.md) | | [optional] +**SshCommands** | Pointer to **[]string** | | [optional] + +## Methods + +### NewSSHServiceStatus + +`func NewSSHServiceStatus() *SSHServiceStatus` + +NewSSHServiceStatus instantiates a new SSHServiceStatus object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSSHServiceStatusWithDefaults + +`func NewSSHServiceStatusWithDefaults() *SSHServiceStatus` + +NewSSHServiceStatusWithDefaults instantiates a new SSHServiceStatus object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIsActive + +`func (o *SSHServiceStatus) GetIsActive() bool` + +GetIsActive returns the IsActive field if non-nil, zero value otherwise. + +### GetIsActiveOk + +`func (o *SSHServiceStatus) GetIsActiveOk() (*bool, bool)` + +GetIsActiveOk returns a tuple with the IsActive field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsActive + +`func (o *SSHServiceStatus) SetIsActive(v bool)` + +SetIsActive sets IsActive field to given value. + +### HasIsActive + +`func (o *SSHServiceStatus) HasIsActive() bool` + +HasIsActive returns a boolean if a field has been set. + +### GetBindings + +`func (o *SSHServiceStatus) GetBindings() []SSHBinding` + +GetBindings returns the Bindings field if non-nil, zero value otherwise. + +### GetBindingsOk + +`func (o *SSHServiceStatus) GetBindingsOk() (*[]SSHBinding, bool)` + +GetBindingsOk returns a tuple with the Bindings field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBindings + +`func (o *SSHServiceStatus) SetBindings(v []SSHBinding)` + +SetBindings sets Bindings field to given value. + +### HasBindings + +`func (o *SSHServiceStatus) HasBindings() bool` + +HasBindings returns a boolean if a field has been set. + +### SetBindingsNil + +`func (o *SSHServiceStatus) SetBindingsNil(b bool)` + + SetBindingsNil sets the value for Bindings to be an explicit nil + +### UnsetBindings +`func (o *SSHServiceStatus) UnsetBindings()` + +UnsetBindings ensures that no value is present for Bindings, not even an explicit nil +### GetHostKeys + +`func (o *SSHServiceStatus) GetHostKeys() []SSHHostKey` + +GetHostKeys returns the HostKeys field if non-nil, zero value otherwise. + +### GetHostKeysOk + +`func (o *SSHServiceStatus) GetHostKeysOk() (*[]SSHHostKey, bool)` + +GetHostKeysOk returns a tuple with the HostKeys field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHostKeys + +`func (o *SSHServiceStatus) SetHostKeys(v []SSHHostKey)` + +SetHostKeys sets HostKeys field to given value. + +### HasHostKeys + +`func (o *SSHServiceStatus) HasHostKeys() bool` + +HasHostKeys returns a boolean if a field has been set. + +### SetHostKeysNil + +`func (o *SSHServiceStatus) SetHostKeysNil(b bool)` + + SetHostKeysNil sets the value for HostKeys to be an explicit nil + +### UnsetHostKeys +`func (o *SSHServiceStatus) UnsetHostKeys()` + +UnsetHostKeys ensures that no value is present for HostKeys, not even an explicit nil +### GetSshCommands + +`func (o *SSHServiceStatus) GetSshCommands() []string` + +GetSshCommands returns the SshCommands field if non-nil, zero value otherwise. + +### GetSshCommandsOk + +`func (o *SSHServiceStatus) GetSshCommandsOk() (*[]string, bool)` + +GetSshCommandsOk returns a tuple with the SshCommands field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSshCommands + +`func (o *SSHServiceStatus) SetSshCommands(v []string)` + +SetSshCommands sets SshCommands field to given value. + +### HasSshCommands + +`func (o *SSHServiceStatus) HasSshCommands() bool` + +HasSshCommands returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/ScoreStatus.md b/server/common/sftpgo/v2/openapi/docs/ScoreStatus.md new file mode 100644 index 00000000..fab06d14 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/ScoreStatus.md @@ -0,0 +1,56 @@ +# ScoreStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Score** | Pointer to **int32** | if 0 the host is not listed | [optional] + +## Methods + +### NewScoreStatus + +`func NewScoreStatus() *ScoreStatus` + +NewScoreStatus instantiates a new ScoreStatus object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewScoreStatusWithDefaults + +`func NewScoreStatusWithDefaults() *ScoreStatus` + +NewScoreStatusWithDefaults instantiates a new ScoreStatus object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetScore + +`func (o *ScoreStatus) GetScore() int32` + +GetScore returns the Score field if non-nil, zero value otherwise. + +### GetScoreOk + +`func (o *ScoreStatus) GetScoreOk() (*int32, bool)` + +GetScoreOk returns a tuple with the Score field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetScore + +`func (o *ScoreStatus) SetScore(v int32)` + +SetScore sets Score field to given value. + +### HasScore + +`func (o *ScoreStatus) HasScore() bool` + +HasScore returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/Secret.md b/server/common/sftpgo/v2/openapi/docs/Secret.md new file mode 100644 index 00000000..6ffef380 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/Secret.md @@ -0,0 +1,160 @@ +# Secret + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Status** | Pointer to **string** | Set to \"Plain\" to add or update an existing secret, set to \"Redacted\" to preserve the existing value | [optional] +**Payload** | Pointer to **string** | | [optional] +**Key** | Pointer to **string** | | [optional] +**AdditionalData** | Pointer to **string** | | [optional] +**Mode** | Pointer to **int32** | 1 means encrypted using a master key | [optional] + +## Methods + +### NewSecret + +`func NewSecret() *Secret` + +NewSecret instantiates a new Secret object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSecretWithDefaults + +`func NewSecretWithDefaults() *Secret` + +NewSecretWithDefaults instantiates a new Secret object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetStatus + +`func (o *Secret) GetStatus() string` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *Secret) GetStatusOk() (*string, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *Secret) SetStatus(v string)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *Secret) HasStatus() bool` + +HasStatus returns a boolean if a field has been set. + +### GetPayload + +`func (o *Secret) GetPayload() string` + +GetPayload returns the Payload field if non-nil, zero value otherwise. + +### GetPayloadOk + +`func (o *Secret) GetPayloadOk() (*string, bool)` + +GetPayloadOk returns a tuple with the Payload field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPayload + +`func (o *Secret) SetPayload(v string)` + +SetPayload sets Payload field to given value. + +### HasPayload + +`func (o *Secret) HasPayload() bool` + +HasPayload returns a boolean if a field has been set. + +### GetKey + +`func (o *Secret) GetKey() string` + +GetKey returns the Key field if non-nil, zero value otherwise. + +### GetKeyOk + +`func (o *Secret) GetKeyOk() (*string, bool)` + +GetKeyOk returns a tuple with the Key field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKey + +`func (o *Secret) SetKey(v string)` + +SetKey sets Key field to given value. + +### HasKey + +`func (o *Secret) HasKey() bool` + +HasKey returns a boolean if a field has been set. + +### GetAdditionalData + +`func (o *Secret) GetAdditionalData() string` + +GetAdditionalData returns the AdditionalData field if non-nil, zero value otherwise. + +### GetAdditionalDataOk + +`func (o *Secret) GetAdditionalDataOk() (*string, bool)` + +GetAdditionalDataOk returns a tuple with the AdditionalData field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAdditionalData + +`func (o *Secret) SetAdditionalData(v string)` + +SetAdditionalData sets AdditionalData field to given value. + +### HasAdditionalData + +`func (o *Secret) HasAdditionalData() bool` + +HasAdditionalData returns a boolean if a field has been set. + +### GetMode + +`func (o *Secret) GetMode() int32` + +GetMode returns the Mode field if non-nil, zero value otherwise. + +### GetModeOk + +`func (o *Secret) GetModeOk() (*int32, bool)` + +GetModeOk returns a tuple with the Mode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMode + +`func (o *Secret) SetMode(v int32)` + +SetMode sets Mode field to given value. + +### HasMode + +`func (o *Secret) HasMode() bool` + +HasMode returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/ServicesStatus.md b/server/common/sftpgo/v2/openapi/docs/ServicesStatus.md new file mode 100644 index 00000000..f1fd0c8d --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/ServicesStatus.md @@ -0,0 +1,186 @@ +# ServicesStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Ssh** | Pointer to [**SSHServiceStatus**](SSHServiceStatus.md) | | [optional] +**Ftp** | Pointer to [**FTPServiceStatus**](FTPServiceStatus.md) | | [optional] +**Webdav** | Pointer to [**WebDAVServiceStatus**](WebDAVServiceStatus.md) | | [optional] +**DataProvider** | Pointer to [**DataProviderStatus**](DataProviderStatus.md) | | [optional] +**Defender** | Pointer to [**ServicesStatusDefender**](ServicesStatusDefender.md) | | [optional] +**Mfa** | Pointer to [**MFAStatus**](MFAStatus.md) | | [optional] + +## Methods + +### NewServicesStatus + +`func NewServicesStatus() *ServicesStatus` + +NewServicesStatus instantiates a new ServicesStatus object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewServicesStatusWithDefaults + +`func NewServicesStatusWithDefaults() *ServicesStatus` + +NewServicesStatusWithDefaults instantiates a new ServicesStatus object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetSsh + +`func (o *ServicesStatus) GetSsh() SSHServiceStatus` + +GetSsh returns the Ssh field if non-nil, zero value otherwise. + +### GetSshOk + +`func (o *ServicesStatus) GetSshOk() (*SSHServiceStatus, bool)` + +GetSshOk returns a tuple with the Ssh field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSsh + +`func (o *ServicesStatus) SetSsh(v SSHServiceStatus)` + +SetSsh sets Ssh field to given value. + +### HasSsh + +`func (o *ServicesStatus) HasSsh() bool` + +HasSsh returns a boolean if a field has been set. + +### GetFtp + +`func (o *ServicesStatus) GetFtp() FTPServiceStatus` + +GetFtp returns the Ftp field if non-nil, zero value otherwise. + +### GetFtpOk + +`func (o *ServicesStatus) GetFtpOk() (*FTPServiceStatus, bool)` + +GetFtpOk returns a tuple with the Ftp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFtp + +`func (o *ServicesStatus) SetFtp(v FTPServiceStatus)` + +SetFtp sets Ftp field to given value. + +### HasFtp + +`func (o *ServicesStatus) HasFtp() bool` + +HasFtp returns a boolean if a field has been set. + +### GetWebdav + +`func (o *ServicesStatus) GetWebdav() WebDAVServiceStatus` + +GetWebdav returns the Webdav field if non-nil, zero value otherwise. + +### GetWebdavOk + +`func (o *ServicesStatus) GetWebdavOk() (*WebDAVServiceStatus, bool)` + +GetWebdavOk returns a tuple with the Webdav field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetWebdav + +`func (o *ServicesStatus) SetWebdav(v WebDAVServiceStatus)` + +SetWebdav sets Webdav field to given value. + +### HasWebdav + +`func (o *ServicesStatus) HasWebdav() bool` + +HasWebdav returns a boolean if a field has been set. + +### GetDataProvider + +`func (o *ServicesStatus) GetDataProvider() DataProviderStatus` + +GetDataProvider returns the DataProvider field if non-nil, zero value otherwise. + +### GetDataProviderOk + +`func (o *ServicesStatus) GetDataProviderOk() (*DataProviderStatus, bool)` + +GetDataProviderOk returns a tuple with the DataProvider field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDataProvider + +`func (o *ServicesStatus) SetDataProvider(v DataProviderStatus)` + +SetDataProvider sets DataProvider field to given value. + +### HasDataProvider + +`func (o *ServicesStatus) HasDataProvider() bool` + +HasDataProvider returns a boolean if a field has been set. + +### GetDefender + +`func (o *ServicesStatus) GetDefender() ServicesStatusDefender` + +GetDefender returns the Defender field if non-nil, zero value otherwise. + +### GetDefenderOk + +`func (o *ServicesStatus) GetDefenderOk() (*ServicesStatusDefender, bool)` + +GetDefenderOk returns a tuple with the Defender field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDefender + +`func (o *ServicesStatus) SetDefender(v ServicesStatusDefender)` + +SetDefender sets Defender field to given value. + +### HasDefender + +`func (o *ServicesStatus) HasDefender() bool` + +HasDefender returns a boolean if a field has been set. + +### GetMfa + +`func (o *ServicesStatus) GetMfa() MFAStatus` + +GetMfa returns the Mfa field if non-nil, zero value otherwise. + +### GetMfaOk + +`func (o *ServicesStatus) GetMfaOk() (*MFAStatus, bool)` + +GetMfaOk returns a tuple with the Mfa field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMfa + +`func (o *ServicesStatus) SetMfa(v MFAStatus)` + +SetMfa sets Mfa field to given value. + +### HasMfa + +`func (o *ServicesStatus) HasMfa() bool` + +HasMfa returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/ServicesStatusDefender.md b/server/common/sftpgo/v2/openapi/docs/ServicesStatusDefender.md new file mode 100644 index 00000000..41752228 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/ServicesStatusDefender.md @@ -0,0 +1,56 @@ +# ServicesStatusDefender + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**IsActive** | Pointer to **bool** | | [optional] + +## Methods + +### NewServicesStatusDefender + +`func NewServicesStatusDefender() *ServicesStatusDefender` + +NewServicesStatusDefender instantiates a new ServicesStatusDefender object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewServicesStatusDefenderWithDefaults + +`func NewServicesStatusDefenderWithDefaults() *ServicesStatusDefender` + +NewServicesStatusDefenderWithDefaults instantiates a new ServicesStatusDefender object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIsActive + +`func (o *ServicesStatusDefender) GetIsActive() bool` + +GetIsActive returns the IsActive field if non-nil, zero value otherwise. + +### GetIsActiveOk + +`func (o *ServicesStatusDefender) GetIsActiveOk() (*bool, bool)` + +GetIsActiveOk returns a tuple with the IsActive field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsActive + +`func (o *ServicesStatusDefender) SetIsActive(v bool)` + +SetIsActive sets IsActive field to given value. + +### HasIsActive + +`func (o *ServicesStatusDefender) HasIsActive() bool` + +HasIsActive returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/Share.md b/server/common/sftpgo/v2/openapi/docs/Share.md new file mode 100644 index 00000000..b74755f5 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/Share.md @@ -0,0 +1,394 @@ +# Share + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | auto-generated unique share identifier | [optional] +**Name** | Pointer to **string** | | [optional] +**Description** | Pointer to **string** | optional description | [optional] +**Scope** | Pointer to [**ShareScope**](ShareScope.md) | | [optional] +**Paths** | Pointer to **[]string** | paths to files or directories, for share scope write this array must contain exactly one directory. Paths will not be validated on save so you can also create them after creating the share | [optional] +**Username** | Pointer to **string** | | [optional] +**CreatedAt** | Pointer to **int64** | creation time as unix timestamp in milliseconds | [optional] +**UpdatedAt** | Pointer to **int64** | last update time as unix timestamp in milliseconds | [optional] +**LastUseAt** | Pointer to **int64** | last use time as unix timestamp in milliseconds | [optional] +**ExpiresAt** | Pointer to **int64** | optional share expiration, as unix timestamp in milliseconds. 0 means no expiration | [optional] +**Password** | Pointer to **string** | optional password to protect the share. The special value \"[**redacted**]\" means that a password has been set, you can use this value if you want to preserve the current password when you update a share | [optional] +**MaxTokens** | Pointer to **int32** | maximum allowed access tokens. 0 means no limit | [optional] +**UsedTokens** | Pointer to **int32** | | [optional] +**AllowFrom** | Pointer to **[]string** | Limit the share availability to these IP/Mask. IP/Mask must be in CIDR notation as defined in RFC 4632 and RFC 4291, for example \"192.0.2.0/24\" or \"2001:db8::/32\". An empty list means no restrictions | [optional] + +## Methods + +### NewShare + +`func NewShare() *Share` + +NewShare instantiates a new Share object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewShareWithDefaults + +`func NewShareWithDefaults() *Share` + +NewShareWithDefaults instantiates a new Share object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *Share) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Share) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Share) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *Share) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetName + +`func (o *Share) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Share) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *Share) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *Share) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetDescription + +`func (o *Share) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *Share) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *Share) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *Share) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetScope + +`func (o *Share) GetScope() ShareScope` + +GetScope returns the Scope field if non-nil, zero value otherwise. + +### GetScopeOk + +`func (o *Share) GetScopeOk() (*ShareScope, bool)` + +GetScopeOk returns a tuple with the Scope field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetScope + +`func (o *Share) SetScope(v ShareScope)` + +SetScope sets Scope field to given value. + +### HasScope + +`func (o *Share) HasScope() bool` + +HasScope returns a boolean if a field has been set. + +### GetPaths + +`func (o *Share) GetPaths() []string` + +GetPaths returns the Paths field if non-nil, zero value otherwise. + +### GetPathsOk + +`func (o *Share) GetPathsOk() (*[]string, bool)` + +GetPathsOk returns a tuple with the Paths field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPaths + +`func (o *Share) SetPaths(v []string)` + +SetPaths sets Paths field to given value. + +### HasPaths + +`func (o *Share) HasPaths() bool` + +HasPaths returns a boolean if a field has been set. + +### GetUsername + +`func (o *Share) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *Share) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *Share) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *Share) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetCreatedAt + +`func (o *Share) GetCreatedAt() int64` + +GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise. + +### GetCreatedAtOk + +`func (o *Share) GetCreatedAtOk() (*int64, bool)` + +GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCreatedAt + +`func (o *Share) SetCreatedAt(v int64)` + +SetCreatedAt sets CreatedAt field to given value. + +### HasCreatedAt + +`func (o *Share) HasCreatedAt() bool` + +HasCreatedAt returns a boolean if a field has been set. + +### GetUpdatedAt + +`func (o *Share) GetUpdatedAt() int64` + +GetUpdatedAt returns the UpdatedAt field if non-nil, zero value otherwise. + +### GetUpdatedAtOk + +`func (o *Share) GetUpdatedAtOk() (*int64, bool)` + +GetUpdatedAtOk returns a tuple with the UpdatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUpdatedAt + +`func (o *Share) SetUpdatedAt(v int64)` + +SetUpdatedAt sets UpdatedAt field to given value. + +### HasUpdatedAt + +`func (o *Share) HasUpdatedAt() bool` + +HasUpdatedAt returns a boolean if a field has been set. + +### GetLastUseAt + +`func (o *Share) GetLastUseAt() int64` + +GetLastUseAt returns the LastUseAt field if non-nil, zero value otherwise. + +### GetLastUseAtOk + +`func (o *Share) GetLastUseAtOk() (*int64, bool)` + +GetLastUseAtOk returns a tuple with the LastUseAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastUseAt + +`func (o *Share) SetLastUseAt(v int64)` + +SetLastUseAt sets LastUseAt field to given value. + +### HasLastUseAt + +`func (o *Share) HasLastUseAt() bool` + +HasLastUseAt returns a boolean if a field has been set. + +### GetExpiresAt + +`func (o *Share) GetExpiresAt() int64` + +GetExpiresAt returns the ExpiresAt field if non-nil, zero value otherwise. + +### GetExpiresAtOk + +`func (o *Share) GetExpiresAtOk() (*int64, bool)` + +GetExpiresAtOk returns a tuple with the ExpiresAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetExpiresAt + +`func (o *Share) SetExpiresAt(v int64)` + +SetExpiresAt sets ExpiresAt field to given value. + +### HasExpiresAt + +`func (o *Share) HasExpiresAt() bool` + +HasExpiresAt returns a boolean if a field has been set. + +### GetPassword + +`func (o *Share) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *Share) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *Share) SetPassword(v string)` + +SetPassword sets Password field to given value. + +### HasPassword + +`func (o *Share) HasPassword() bool` + +HasPassword returns a boolean if a field has been set. + +### GetMaxTokens + +`func (o *Share) GetMaxTokens() int32` + +GetMaxTokens returns the MaxTokens field if non-nil, zero value otherwise. + +### GetMaxTokensOk + +`func (o *Share) GetMaxTokensOk() (*int32, bool)` + +GetMaxTokensOk returns a tuple with the MaxTokens field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaxTokens + +`func (o *Share) SetMaxTokens(v int32)` + +SetMaxTokens sets MaxTokens field to given value. + +### HasMaxTokens + +`func (o *Share) HasMaxTokens() bool` + +HasMaxTokens returns a boolean if a field has been set. + +### GetUsedTokens + +`func (o *Share) GetUsedTokens() int32` + +GetUsedTokens returns the UsedTokens field if non-nil, zero value otherwise. + +### GetUsedTokensOk + +`func (o *Share) GetUsedTokensOk() (*int32, bool)` + +GetUsedTokensOk returns a tuple with the UsedTokens field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedTokens + +`func (o *Share) SetUsedTokens(v int32)` + +SetUsedTokens sets UsedTokens field to given value. + +### HasUsedTokens + +`func (o *Share) HasUsedTokens() bool` + +HasUsedTokens returns a boolean if a field has been set. + +### GetAllowFrom + +`func (o *Share) GetAllowFrom() []string` + +GetAllowFrom returns the AllowFrom field if non-nil, zero value otherwise. + +### GetAllowFromOk + +`func (o *Share) GetAllowFromOk() (*[]string, bool)` + +GetAllowFromOk returns a tuple with the AllowFrom field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAllowFrom + +`func (o *Share) SetAllowFrom(v []string)` + +SetAllowFrom sets AllowFrom field to given value. + +### HasAllowFrom + +`func (o *Share) HasAllowFrom() bool` + +HasAllowFrom returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/ShareScope.md b/server/common/sftpgo/v2/openapi/docs/ShareScope.md new file mode 100644 index 00000000..da88b839 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/ShareScope.md @@ -0,0 +1,13 @@ +# ShareScope + +## Enum + + +* `_1` (value: `1`) + +* `_2` (value: `2`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/SupportedProtocols.md b/server/common/sftpgo/v2/openapi/docs/SupportedProtocols.md new file mode 100644 index 00000000..34cdb378 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/SupportedProtocols.md @@ -0,0 +1,17 @@ +# SupportedProtocols + +## Enum + + +* `SSH` (value: `"SSH"`) + +* `FTP` (value: `"FTP"`) + +* `DAV` (value: `"DAV"`) + +* `HTTP` (value: `"HTTP"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/TOTPConfig.md b/server/common/sftpgo/v2/openapi/docs/TOTPConfig.md new file mode 100644 index 00000000..8fceff02 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/TOTPConfig.md @@ -0,0 +1,108 @@ +# TOTPConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | | [optional] +**Issuer** | Pointer to **string** | | [optional] +**Algo** | Pointer to [**TOTPHMacAlgo**](TOTPHMacAlgo.md) | | [optional] + +## Methods + +### NewTOTPConfig + +`func NewTOTPConfig() *TOTPConfig` + +NewTOTPConfig instantiates a new TOTPConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTOTPConfigWithDefaults + +`func NewTOTPConfigWithDefaults() *TOTPConfig` + +NewTOTPConfigWithDefaults instantiates a new TOTPConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *TOTPConfig) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *TOTPConfig) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *TOTPConfig) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *TOTPConfig) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetIssuer + +`func (o *TOTPConfig) GetIssuer() string` + +GetIssuer returns the Issuer field if non-nil, zero value otherwise. + +### GetIssuerOk + +`func (o *TOTPConfig) GetIssuerOk() (*string, bool)` + +GetIssuerOk returns a tuple with the Issuer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIssuer + +`func (o *TOTPConfig) SetIssuer(v string)` + +SetIssuer sets Issuer field to given value. + +### HasIssuer + +`func (o *TOTPConfig) HasIssuer() bool` + +HasIssuer returns a boolean if a field has been set. + +### GetAlgo + +`func (o *TOTPConfig) GetAlgo() TOTPHMacAlgo` + +GetAlgo returns the Algo field if non-nil, zero value otherwise. + +### GetAlgoOk + +`func (o *TOTPConfig) GetAlgoOk() (*TOTPHMacAlgo, bool)` + +GetAlgoOk returns a tuple with the Algo field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlgo + +`func (o *TOTPConfig) SetAlgo(v TOTPHMacAlgo)` + +SetAlgo sets Algo field to given value. + +### HasAlgo + +`func (o *TOTPConfig) HasAlgo() bool` + +HasAlgo returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/TOTPHMacAlgo.md b/server/common/sftpgo/v2/openapi/docs/TOTPHMacAlgo.md new file mode 100644 index 00000000..98688328 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/TOTPHMacAlgo.md @@ -0,0 +1,15 @@ +# TOTPHMacAlgo + +## Enum + + +* `SHA1` (value: `"sha1"`) + +* `SHA256` (value: `"sha256"`) + +* `SHA512` (value: `"sha512"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/Token.md b/server/common/sftpgo/v2/openapi/docs/Token.md new file mode 100644 index 00000000..228ffdee --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/Token.md @@ -0,0 +1,82 @@ +# Token + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AccessToken** | Pointer to **string** | | [optional] +**ExpiresAt** | Pointer to **time.Time** | | [optional] + +## Methods + +### NewToken + +`func NewToken() *Token` + +NewToken instantiates a new Token object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTokenWithDefaults + +`func NewTokenWithDefaults() *Token` + +NewTokenWithDefaults instantiates a new Token object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAccessToken + +`func (o *Token) GetAccessToken() string` + +GetAccessToken returns the AccessToken field if non-nil, zero value otherwise. + +### GetAccessTokenOk + +`func (o *Token) GetAccessTokenOk() (*string, bool)` + +GetAccessTokenOk returns a tuple with the AccessToken field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAccessToken + +`func (o *Token) SetAccessToken(v string)` + +SetAccessToken sets AccessToken field to given value. + +### HasAccessToken + +`func (o *Token) HasAccessToken() bool` + +HasAccessToken returns a boolean if a field has been set. + +### GetExpiresAt + +`func (o *Token) GetExpiresAt() time.Time` + +GetExpiresAt returns the ExpiresAt field if non-nil, zero value otherwise. + +### GetExpiresAtOk + +`func (o *Token) GetExpiresAtOk() (*time.Time, bool)` + +GetExpiresAtOk returns a tuple with the ExpiresAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetExpiresAt + +`func (o *Token) SetExpiresAt(v time.Time)` + +SetExpiresAt sets ExpiresAt field to given value. + +### HasExpiresAt + +`func (o *Token) HasExpiresAt() bool` + +HasExpiresAt returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/TokenApi.md b/server/common/sftpgo/v2/openapi/docs/TokenApi.md new file mode 100644 index 00000000..59d4048c --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/TokenApi.md @@ -0,0 +1,266 @@ +# \TokenApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**ClientLogout**](TokenApi.md#ClientLogout) | **Get** /user/logout | Invalidate a user access token +[**GetToken**](TokenApi.md#GetToken) | **Get** /token | Get a new admin access token +[**GetUserToken**](TokenApi.md#GetUserToken) | **Get** /user/token | Get a new user access token +[**Logout**](TokenApi.md#Logout) | **Get** /logout | Invalidate an admin access token + + + +## ClientLogout + +> ApiResponse ClientLogout(ctx).Execute() + +Invalidate a user access token + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.TokenApi.ClientLogout(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TokenApi.ClientLogout``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ClientLogout`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `TokenApi.ClientLogout`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiClientLogoutRequest struct via the builder pattern + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetToken + +> Token GetToken(ctx).XSFTPGOOTP(xSFTPGOOTP).Execute() + +Get a new admin access token + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + xSFTPGOOTP := "xSFTPGOOTP_example" // string | If you have 2FA configured for the admin attempting to log in you need to set the authentication code using this header parameter (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.TokenApi.GetToken(context.Background()).XSFTPGOOTP(xSFTPGOOTP).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TokenApi.GetToken``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetToken`: Token + fmt.Fprintf(os.Stdout, "Response from `TokenApi.GetToken`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetTokenRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xSFTPGOOTP** | **string** | If you have 2FA configured for the admin attempting to log in you need to set the authentication code using this header parameter | + +### Return type + +[**Token**](Token.md) + +### Authorization + +[BasicAuth](../README.md#BasicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserToken + +> Token GetUserToken(ctx).XSFTPGOOTP(xSFTPGOOTP).Execute() + +Get a new user access token + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + xSFTPGOOTP := "xSFTPGOOTP_example" // string | If you have 2FA configured, for the HTTP protocol, for the user attempting to log in you need to set the authentication code using this header parameter (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.TokenApi.GetUserToken(context.Background()).XSFTPGOOTP(xSFTPGOOTP).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TokenApi.GetUserToken``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserToken`: Token + fmt.Fprintf(os.Stdout, "Response from `TokenApi.GetUserToken`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserTokenRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xSFTPGOOTP** | **string** | If you have 2FA configured, for the HTTP protocol, for the user attempting to log in you need to set the authentication code using this header parameter | + +### Return type + +[**Token**](Token.md) + +### Authorization + +[BasicAuth](../README.md#BasicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## Logout + +> ApiResponse Logout(ctx).Execute() + +Invalidate an admin access token + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.TokenApi.Logout(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TokenApi.Logout``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Logout`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `TokenApi.Logout`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiLogoutRequest struct via the builder pattern + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/Transfer.md b/server/common/sftpgo/v2/openapi/docs/Transfer.md new file mode 100644 index 00000000..08b8cb6f --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/Transfer.md @@ -0,0 +1,134 @@ +# Transfer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OperationType** | Pointer to **string** | Operations: * `upload` * `download` | [optional] +**Path** | Pointer to **string** | file path for the upload/download | [optional] +**StartTime** | Pointer to **int64** | start time as unix timestamp in milliseconds | [optional] +**Size** | Pointer to **int64** | bytes transferred | [optional] + +## Methods + +### NewTransfer + +`func NewTransfer() *Transfer` + +NewTransfer instantiates a new Transfer object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTransferWithDefaults + +`func NewTransferWithDefaults() *Transfer` + +NewTransferWithDefaults instantiates a new Transfer object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetOperationType + +`func (o *Transfer) GetOperationType() string` + +GetOperationType returns the OperationType field if non-nil, zero value otherwise. + +### GetOperationTypeOk + +`func (o *Transfer) GetOperationTypeOk() (*string, bool)` + +GetOperationTypeOk returns a tuple with the OperationType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOperationType + +`func (o *Transfer) SetOperationType(v string)` + +SetOperationType sets OperationType field to given value. + +### HasOperationType + +`func (o *Transfer) HasOperationType() bool` + +HasOperationType returns a boolean if a field has been set. + +### GetPath + +`func (o *Transfer) GetPath() string` + +GetPath returns the Path field if non-nil, zero value otherwise. + +### GetPathOk + +`func (o *Transfer) GetPathOk() (*string, bool)` + +GetPathOk returns a tuple with the Path field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPath + +`func (o *Transfer) SetPath(v string)` + +SetPath sets Path field to given value. + +### HasPath + +`func (o *Transfer) HasPath() bool` + +HasPath returns a boolean if a field has been set. + +### GetStartTime + +`func (o *Transfer) GetStartTime() int64` + +GetStartTime returns the StartTime field if non-nil, zero value otherwise. + +### GetStartTimeOk + +`func (o *Transfer) GetStartTimeOk() (*int64, bool)` + +GetStartTimeOk returns a tuple with the StartTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStartTime + +`func (o *Transfer) SetStartTime(v int64)` + +SetStartTime sets StartTime field to given value. + +### HasStartTime + +`func (o *Transfer) HasStartTime() bool` + +HasStartTime returns a boolean if a field has been set. + +### GetSize + +`func (o *Transfer) GetSize() int64` + +GetSize returns the Size field if non-nil, zero value otherwise. + +### GetSizeOk + +`func (o *Transfer) GetSizeOk() (*int64, bool)` + +GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSize + +`func (o *Transfer) SetSize(v int64)` + +SetSize sets Size field to given value. + +### HasSize + +`func (o *Transfer) HasSize() bool` + +HasSize returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/TransferQuotaUsage.md b/server/common/sftpgo/v2/openapi/docs/TransferQuotaUsage.md new file mode 100644 index 00000000..dcbc3245 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/TransferQuotaUsage.md @@ -0,0 +1,82 @@ +# TransferQuotaUsage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**UsedUploadDataTransfer** | Pointer to **int64** | The value must be specified as bytes | [optional] +**UsedDownloadDataTransfer** | Pointer to **int64** | The value must be specified as bytes | [optional] + +## Methods + +### NewTransferQuotaUsage + +`func NewTransferQuotaUsage() *TransferQuotaUsage` + +NewTransferQuotaUsage instantiates a new TransferQuotaUsage object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTransferQuotaUsageWithDefaults + +`func NewTransferQuotaUsageWithDefaults() *TransferQuotaUsage` + +NewTransferQuotaUsageWithDefaults instantiates a new TransferQuotaUsage object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetUsedUploadDataTransfer + +`func (o *TransferQuotaUsage) GetUsedUploadDataTransfer() int64` + +GetUsedUploadDataTransfer returns the UsedUploadDataTransfer field if non-nil, zero value otherwise. + +### GetUsedUploadDataTransferOk + +`func (o *TransferQuotaUsage) GetUsedUploadDataTransferOk() (*int64, bool)` + +GetUsedUploadDataTransferOk returns a tuple with the UsedUploadDataTransfer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedUploadDataTransfer + +`func (o *TransferQuotaUsage) SetUsedUploadDataTransfer(v int64)` + +SetUsedUploadDataTransfer sets UsedUploadDataTransfer field to given value. + +### HasUsedUploadDataTransfer + +`func (o *TransferQuotaUsage) HasUsedUploadDataTransfer() bool` + +HasUsedUploadDataTransfer returns a boolean if a field has been set. + +### GetUsedDownloadDataTransfer + +`func (o *TransferQuotaUsage) GetUsedDownloadDataTransfer() int64` + +GetUsedDownloadDataTransfer returns the UsedDownloadDataTransfer field if non-nil, zero value otherwise. + +### GetUsedDownloadDataTransferOk + +`func (o *TransferQuotaUsage) GetUsedDownloadDataTransferOk() (*int64, bool)` + +GetUsedDownloadDataTransferOk returns a tuple with the UsedDownloadDataTransfer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedDownloadDataTransfer + +`func (o *TransferQuotaUsage) SetUsedDownloadDataTransfer(v int64)` + +SetUsedDownloadDataTransfer sets UsedDownloadDataTransfer field to given value. + +### HasUsedDownloadDataTransfer + +`func (o *TransferQuotaUsage) HasUsedDownloadDataTransfer() bool` + +HasUsedDownloadDataTransfer returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/User.md b/server/common/sftpgo/v2/openapi/docs/User.md new file mode 100644 index 00000000..c9f9ad60 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/User.md @@ -0,0 +1,862 @@ +# User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int32** | | [optional] +**Status** | Pointer to **int32** | status: * `0` user is disabled, login is not allowed * `1` user is enabled | [optional] +**Username** | Pointer to **string** | username is unique | [optional] +**Email** | Pointer to **string** | | [optional] +**Description** | Pointer to **string** | optional description, for example the user full name | [optional] +**ExpirationDate** | Pointer to **int64** | expiration date as unix timestamp in milliseconds. An expired account cannot login. 0 means no expiration | [optional] +**Password** | Pointer to **string** | password or public key/SSH user certificate are mandatory. If the password has no known hashing algo prefix it will be stored, by default, using bcrypt, argon2id is supported too. You can send a password hashed as bcrypt ($2a$ prefix), argon2id, pbkdf2 or unix crypt and it will be stored as is. For security reasons this field is omitted when you search/get users | [optional] +**PublicKeys** | Pointer to **[]string** | Public keys in OpenSSH format. A password or at least one public key/SSH user certificate are mandatory. | [optional] +**HomeDir** | Pointer to **string** | path to the user home directory. The user cannot upload or download files outside this directory. SFTPGo tries to automatically create this folder if missing. Must be an absolute path | [optional] +**VirtualFolders** | Pointer to [**[]VirtualFolder**](VirtualFolder.md) | mapping between virtual SFTPGo paths and filesystem paths outside the user home directory. Supported for local filesystem only. If one or more of the specified folders are not inside the dataprovider they will be automatically created. You have to create the folder on the filesystem yourself | [optional] +**Uid** | Pointer to **int32** | if you run SFTPGo as root user, the created files and directories will be assigned to this uid. 0 means no change, the owner will be the user that runs SFTPGo. Ignored on windows | [optional] +**Gid** | Pointer to **int32** | if you run SFTPGo as root user, the created files and directories will be assigned to this gid. 0 means no change, the group will be the one of the user that runs SFTPGo. Ignored on windows | [optional] +**MaxSessions** | Pointer to **int32** | Limit the sessions that a user can open. 0 means unlimited | [optional] +**QuotaSize** | Pointer to **int64** | Quota as size in bytes. 0 menas unlimited. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed | [optional] +**QuotaFiles** | Pointer to **int32** | Quota as number of files. 0 menas unlimited. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed | [optional] +**Permissions** | Pointer to [**[]map[string][]Permission**](map[string][]Permission.md) | | [optional] +**UsedQuotaSize** | Pointer to **int64** | | [optional] +**UsedQuotaFiles** | Pointer to **int32** | | [optional] +**LastQuotaUpdate** | Pointer to **int64** | Last quota update as unix timestamp in milliseconds | [optional] +**UploadBandwidth** | Pointer to **int32** | Maximum upload bandwidth as KB/s, 0 means unlimited | [optional] +**DownloadBandwidth** | Pointer to **int32** | Maximum download bandwidth as KB/s, 0 means unlimited | [optional] +**UploadDataTransfer** | Pointer to **int32** | Maximum data transfer allowed for uploads as MB. 0 means no limit | [optional] +**DownloadDataTransfer** | Pointer to **int32** | Maximum data transfer allowed for downloads as MB. 0 means no limit | [optional] +**TotalDataTransfer** | Pointer to **int32** | Maximum total data transfer as MB. 0 means unlimited. You can set a total data transfer instead of the individual values for uploads and downloads | [optional] +**UsedUploadDataTransfer** | Pointer to **int32** | Uploaded size, as bytes, since the last reset | [optional] +**UsedDownloadDataTransfer** | Pointer to **int32** | Downloaded size, as bytes, since the last reset | [optional] +**CreatedAt** | Pointer to **int64** | creation time as unix timestamp in milliseconds. It will be 0 for users created before v2.2.0 | [optional] +**UpdatedAt** | Pointer to **int64** | last update time as unix timestamp in milliseconds | [optional] +**LastLogin** | Pointer to **int64** | Last user login as unix timestamp in milliseconds. It is saved at most once every 10 minutes | [optional] +**Filters** | Pointer to [**UserFilters**](UserFilters.md) | | [optional] +**Filesystem** | Pointer to [**FilesystemConfig**](FilesystemConfig.md) | | [optional] +**AdditionalInfo** | Pointer to **string** | Free form text field for external systems | [optional] + +## Methods + +### NewUser + +`func NewUser() *User` + +NewUser instantiates a new User object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUserWithDefaults + +`func NewUserWithDefaults() *User` + +NewUserWithDefaults instantiates a new User object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *User) GetId() int32` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *User) GetIdOk() (*int32, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *User) SetId(v int32)` + +SetId sets Id field to given value. + +### HasId + +`func (o *User) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetStatus + +`func (o *User) GetStatus() int32` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *User) GetStatusOk() (*int32, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *User) SetStatus(v int32)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *User) HasStatus() bool` + +HasStatus returns a boolean if a field has been set. + +### GetUsername + +`func (o *User) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *User) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *User) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *User) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetEmail + +`func (o *User) GetEmail() string` + +GetEmail returns the Email field if non-nil, zero value otherwise. + +### GetEmailOk + +`func (o *User) GetEmailOk() (*string, bool)` + +GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEmail + +`func (o *User) SetEmail(v string)` + +SetEmail sets Email field to given value. + +### HasEmail + +`func (o *User) HasEmail() bool` + +HasEmail returns a boolean if a field has been set. + +### GetDescription + +`func (o *User) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *User) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *User) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *User) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetExpirationDate + +`func (o *User) GetExpirationDate() int64` + +GetExpirationDate returns the ExpirationDate field if non-nil, zero value otherwise. + +### GetExpirationDateOk + +`func (o *User) GetExpirationDateOk() (*int64, bool)` + +GetExpirationDateOk returns a tuple with the ExpirationDate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetExpirationDate + +`func (o *User) SetExpirationDate(v int64)` + +SetExpirationDate sets ExpirationDate field to given value. + +### HasExpirationDate + +`func (o *User) HasExpirationDate() bool` + +HasExpirationDate returns a boolean if a field has been set. + +### GetPassword + +`func (o *User) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *User) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *User) SetPassword(v string)` + +SetPassword sets Password field to given value. + +### HasPassword + +`func (o *User) HasPassword() bool` + +HasPassword returns a boolean if a field has been set. + +### GetPublicKeys + +`func (o *User) GetPublicKeys() []string` + +GetPublicKeys returns the PublicKeys field if non-nil, zero value otherwise. + +### GetPublicKeysOk + +`func (o *User) GetPublicKeysOk() (*[]string, bool)` + +GetPublicKeysOk returns a tuple with the PublicKeys field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicKeys + +`func (o *User) SetPublicKeys(v []string)` + +SetPublicKeys sets PublicKeys field to given value. + +### HasPublicKeys + +`func (o *User) HasPublicKeys() bool` + +HasPublicKeys returns a boolean if a field has been set. + +### GetHomeDir + +`func (o *User) GetHomeDir() string` + +GetHomeDir returns the HomeDir field if non-nil, zero value otherwise. + +### GetHomeDirOk + +`func (o *User) GetHomeDirOk() (*string, bool)` + +GetHomeDirOk returns a tuple with the HomeDir field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHomeDir + +`func (o *User) SetHomeDir(v string)` + +SetHomeDir sets HomeDir field to given value. + +### HasHomeDir + +`func (o *User) HasHomeDir() bool` + +HasHomeDir returns a boolean if a field has been set. + +### GetVirtualFolders + +`func (o *User) GetVirtualFolders() []VirtualFolder` + +GetVirtualFolders returns the VirtualFolders field if non-nil, zero value otherwise. + +### GetVirtualFoldersOk + +`func (o *User) GetVirtualFoldersOk() (*[]VirtualFolder, bool)` + +GetVirtualFoldersOk returns a tuple with the VirtualFolders field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVirtualFolders + +`func (o *User) SetVirtualFolders(v []VirtualFolder)` + +SetVirtualFolders sets VirtualFolders field to given value. + +### HasVirtualFolders + +`func (o *User) HasVirtualFolders() bool` + +HasVirtualFolders returns a boolean if a field has been set. + +### GetUid + +`func (o *User) GetUid() int32` + +GetUid returns the Uid field if non-nil, zero value otherwise. + +### GetUidOk + +`func (o *User) GetUidOk() (*int32, bool)` + +GetUidOk returns a tuple with the Uid field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUid + +`func (o *User) SetUid(v int32)` + +SetUid sets Uid field to given value. + +### HasUid + +`func (o *User) HasUid() bool` + +HasUid returns a boolean if a field has been set. + +### GetGid + +`func (o *User) GetGid() int32` + +GetGid returns the Gid field if non-nil, zero value otherwise. + +### GetGidOk + +`func (o *User) GetGidOk() (*int32, bool)` + +GetGidOk returns a tuple with the Gid field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGid + +`func (o *User) SetGid(v int32)` + +SetGid sets Gid field to given value. + +### HasGid + +`func (o *User) HasGid() bool` + +HasGid returns a boolean if a field has been set. + +### GetMaxSessions + +`func (o *User) GetMaxSessions() int32` + +GetMaxSessions returns the MaxSessions field if non-nil, zero value otherwise. + +### GetMaxSessionsOk + +`func (o *User) GetMaxSessionsOk() (*int32, bool)` + +GetMaxSessionsOk returns a tuple with the MaxSessions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaxSessions + +`func (o *User) SetMaxSessions(v int32)` + +SetMaxSessions sets MaxSessions field to given value. + +### HasMaxSessions + +`func (o *User) HasMaxSessions() bool` + +HasMaxSessions returns a boolean if a field has been set. + +### GetQuotaSize + +`func (o *User) GetQuotaSize() int64` + +GetQuotaSize returns the QuotaSize field if non-nil, zero value otherwise. + +### GetQuotaSizeOk + +`func (o *User) GetQuotaSizeOk() (*int64, bool)` + +GetQuotaSizeOk returns a tuple with the QuotaSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuotaSize + +`func (o *User) SetQuotaSize(v int64)` + +SetQuotaSize sets QuotaSize field to given value. + +### HasQuotaSize + +`func (o *User) HasQuotaSize() bool` + +HasQuotaSize returns a boolean if a field has been set. + +### GetQuotaFiles + +`func (o *User) GetQuotaFiles() int32` + +GetQuotaFiles returns the QuotaFiles field if non-nil, zero value otherwise. + +### GetQuotaFilesOk + +`func (o *User) GetQuotaFilesOk() (*int32, bool)` + +GetQuotaFilesOk returns a tuple with the QuotaFiles field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuotaFiles + +`func (o *User) SetQuotaFiles(v int32)` + +SetQuotaFiles sets QuotaFiles field to given value. + +### HasQuotaFiles + +`func (o *User) HasQuotaFiles() bool` + +HasQuotaFiles returns a boolean if a field has been set. + +### GetPermissions + +`func (o *User) GetPermissions() []map[string][]Permission` + +GetPermissions returns the Permissions field if non-nil, zero value otherwise. + +### GetPermissionsOk + +`func (o *User) GetPermissionsOk() (*[]map[string][]Permission, bool)` + +GetPermissionsOk returns a tuple with the Permissions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPermissions + +`func (o *User) SetPermissions(v []map[string][]Permission)` + +SetPermissions sets Permissions field to given value. + +### HasPermissions + +`func (o *User) HasPermissions() bool` + +HasPermissions returns a boolean if a field has been set. + +### GetUsedQuotaSize + +`func (o *User) GetUsedQuotaSize() int64` + +GetUsedQuotaSize returns the UsedQuotaSize field if non-nil, zero value otherwise. + +### GetUsedQuotaSizeOk + +`func (o *User) GetUsedQuotaSizeOk() (*int64, bool)` + +GetUsedQuotaSizeOk returns a tuple with the UsedQuotaSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedQuotaSize + +`func (o *User) SetUsedQuotaSize(v int64)` + +SetUsedQuotaSize sets UsedQuotaSize field to given value. + +### HasUsedQuotaSize + +`func (o *User) HasUsedQuotaSize() bool` + +HasUsedQuotaSize returns a boolean if a field has been set. + +### GetUsedQuotaFiles + +`func (o *User) GetUsedQuotaFiles() int32` + +GetUsedQuotaFiles returns the UsedQuotaFiles field if non-nil, zero value otherwise. + +### GetUsedQuotaFilesOk + +`func (o *User) GetUsedQuotaFilesOk() (*int32, bool)` + +GetUsedQuotaFilesOk returns a tuple with the UsedQuotaFiles field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedQuotaFiles + +`func (o *User) SetUsedQuotaFiles(v int32)` + +SetUsedQuotaFiles sets UsedQuotaFiles field to given value. + +### HasUsedQuotaFiles + +`func (o *User) HasUsedQuotaFiles() bool` + +HasUsedQuotaFiles returns a boolean if a field has been set. + +### GetLastQuotaUpdate + +`func (o *User) GetLastQuotaUpdate() int64` + +GetLastQuotaUpdate returns the LastQuotaUpdate field if non-nil, zero value otherwise. + +### GetLastQuotaUpdateOk + +`func (o *User) GetLastQuotaUpdateOk() (*int64, bool)` + +GetLastQuotaUpdateOk returns a tuple with the LastQuotaUpdate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastQuotaUpdate + +`func (o *User) SetLastQuotaUpdate(v int64)` + +SetLastQuotaUpdate sets LastQuotaUpdate field to given value. + +### HasLastQuotaUpdate + +`func (o *User) HasLastQuotaUpdate() bool` + +HasLastQuotaUpdate returns a boolean if a field has been set. + +### GetUploadBandwidth + +`func (o *User) GetUploadBandwidth() int32` + +GetUploadBandwidth returns the UploadBandwidth field if non-nil, zero value otherwise. + +### GetUploadBandwidthOk + +`func (o *User) GetUploadBandwidthOk() (*int32, bool)` + +GetUploadBandwidthOk returns a tuple with the UploadBandwidth field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUploadBandwidth + +`func (o *User) SetUploadBandwidth(v int32)` + +SetUploadBandwidth sets UploadBandwidth field to given value. + +### HasUploadBandwidth + +`func (o *User) HasUploadBandwidth() bool` + +HasUploadBandwidth returns a boolean if a field has been set. + +### GetDownloadBandwidth + +`func (o *User) GetDownloadBandwidth() int32` + +GetDownloadBandwidth returns the DownloadBandwidth field if non-nil, zero value otherwise. + +### GetDownloadBandwidthOk + +`func (o *User) GetDownloadBandwidthOk() (*int32, bool)` + +GetDownloadBandwidthOk returns a tuple with the DownloadBandwidth field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDownloadBandwidth + +`func (o *User) SetDownloadBandwidth(v int32)` + +SetDownloadBandwidth sets DownloadBandwidth field to given value. + +### HasDownloadBandwidth + +`func (o *User) HasDownloadBandwidth() bool` + +HasDownloadBandwidth returns a boolean if a field has been set. + +### GetUploadDataTransfer + +`func (o *User) GetUploadDataTransfer() int32` + +GetUploadDataTransfer returns the UploadDataTransfer field if non-nil, zero value otherwise. + +### GetUploadDataTransferOk + +`func (o *User) GetUploadDataTransferOk() (*int32, bool)` + +GetUploadDataTransferOk returns a tuple with the UploadDataTransfer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUploadDataTransfer + +`func (o *User) SetUploadDataTransfer(v int32)` + +SetUploadDataTransfer sets UploadDataTransfer field to given value. + +### HasUploadDataTransfer + +`func (o *User) HasUploadDataTransfer() bool` + +HasUploadDataTransfer returns a boolean if a field has been set. + +### GetDownloadDataTransfer + +`func (o *User) GetDownloadDataTransfer() int32` + +GetDownloadDataTransfer returns the DownloadDataTransfer field if non-nil, zero value otherwise. + +### GetDownloadDataTransferOk + +`func (o *User) GetDownloadDataTransferOk() (*int32, bool)` + +GetDownloadDataTransferOk returns a tuple with the DownloadDataTransfer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDownloadDataTransfer + +`func (o *User) SetDownloadDataTransfer(v int32)` + +SetDownloadDataTransfer sets DownloadDataTransfer field to given value. + +### HasDownloadDataTransfer + +`func (o *User) HasDownloadDataTransfer() bool` + +HasDownloadDataTransfer returns a boolean if a field has been set. + +### GetTotalDataTransfer + +`func (o *User) GetTotalDataTransfer() int32` + +GetTotalDataTransfer returns the TotalDataTransfer field if non-nil, zero value otherwise. + +### GetTotalDataTransferOk + +`func (o *User) GetTotalDataTransferOk() (*int32, bool)` + +GetTotalDataTransferOk returns a tuple with the TotalDataTransfer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotalDataTransfer + +`func (o *User) SetTotalDataTransfer(v int32)` + +SetTotalDataTransfer sets TotalDataTransfer field to given value. + +### HasTotalDataTransfer + +`func (o *User) HasTotalDataTransfer() bool` + +HasTotalDataTransfer returns a boolean if a field has been set. + +### GetUsedUploadDataTransfer + +`func (o *User) GetUsedUploadDataTransfer() int32` + +GetUsedUploadDataTransfer returns the UsedUploadDataTransfer field if non-nil, zero value otherwise. + +### GetUsedUploadDataTransferOk + +`func (o *User) GetUsedUploadDataTransferOk() (*int32, bool)` + +GetUsedUploadDataTransferOk returns a tuple with the UsedUploadDataTransfer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedUploadDataTransfer + +`func (o *User) SetUsedUploadDataTransfer(v int32)` + +SetUsedUploadDataTransfer sets UsedUploadDataTransfer field to given value. + +### HasUsedUploadDataTransfer + +`func (o *User) HasUsedUploadDataTransfer() bool` + +HasUsedUploadDataTransfer returns a boolean if a field has been set. + +### GetUsedDownloadDataTransfer + +`func (o *User) GetUsedDownloadDataTransfer() int32` + +GetUsedDownloadDataTransfer returns the UsedDownloadDataTransfer field if non-nil, zero value otherwise. + +### GetUsedDownloadDataTransferOk + +`func (o *User) GetUsedDownloadDataTransferOk() (*int32, bool)` + +GetUsedDownloadDataTransferOk returns a tuple with the UsedDownloadDataTransfer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedDownloadDataTransfer + +`func (o *User) SetUsedDownloadDataTransfer(v int32)` + +SetUsedDownloadDataTransfer sets UsedDownloadDataTransfer field to given value. + +### HasUsedDownloadDataTransfer + +`func (o *User) HasUsedDownloadDataTransfer() bool` + +HasUsedDownloadDataTransfer returns a boolean if a field has been set. + +### GetCreatedAt + +`func (o *User) GetCreatedAt() int64` + +GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise. + +### GetCreatedAtOk + +`func (o *User) GetCreatedAtOk() (*int64, bool)` + +GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCreatedAt + +`func (o *User) SetCreatedAt(v int64)` + +SetCreatedAt sets CreatedAt field to given value. + +### HasCreatedAt + +`func (o *User) HasCreatedAt() bool` + +HasCreatedAt returns a boolean if a field has been set. + +### GetUpdatedAt + +`func (o *User) GetUpdatedAt() int64` + +GetUpdatedAt returns the UpdatedAt field if non-nil, zero value otherwise. + +### GetUpdatedAtOk + +`func (o *User) GetUpdatedAtOk() (*int64, bool)` + +GetUpdatedAtOk returns a tuple with the UpdatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUpdatedAt + +`func (o *User) SetUpdatedAt(v int64)` + +SetUpdatedAt sets UpdatedAt field to given value. + +### HasUpdatedAt + +`func (o *User) HasUpdatedAt() bool` + +HasUpdatedAt returns a boolean if a field has been set. + +### GetLastLogin + +`func (o *User) GetLastLogin() int64` + +GetLastLogin returns the LastLogin field if non-nil, zero value otherwise. + +### GetLastLoginOk + +`func (o *User) GetLastLoginOk() (*int64, bool)` + +GetLastLoginOk returns a tuple with the LastLogin field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastLogin + +`func (o *User) SetLastLogin(v int64)` + +SetLastLogin sets LastLogin field to given value. + +### HasLastLogin + +`func (o *User) HasLastLogin() bool` + +HasLastLogin returns a boolean if a field has been set. + +### GetFilters + +`func (o *User) GetFilters() UserFilters` + +GetFilters returns the Filters field if non-nil, zero value otherwise. + +### GetFiltersOk + +`func (o *User) GetFiltersOk() (*UserFilters, bool)` + +GetFiltersOk returns a tuple with the Filters field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilters + +`func (o *User) SetFilters(v UserFilters)` + +SetFilters sets Filters field to given value. + +### HasFilters + +`func (o *User) HasFilters() bool` + +HasFilters returns a boolean if a field has been set. + +### GetFilesystem + +`func (o *User) GetFilesystem() FilesystemConfig` + +GetFilesystem returns the Filesystem field if non-nil, zero value otherwise. + +### GetFilesystemOk + +`func (o *User) GetFilesystemOk() (*FilesystemConfig, bool)` + +GetFilesystemOk returns a tuple with the Filesystem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilesystem + +`func (o *User) SetFilesystem(v FilesystemConfig)` + +SetFilesystem sets Filesystem field to given value. + +### HasFilesystem + +`func (o *User) HasFilesystem() bool` + +HasFilesystem returns a boolean if a field has been set. + +### GetAdditionalInfo + +`func (o *User) GetAdditionalInfo() string` + +GetAdditionalInfo returns the AdditionalInfo field if non-nil, zero value otherwise. + +### GetAdditionalInfoOk + +`func (o *User) GetAdditionalInfoOk() (*string, bool)` + +GetAdditionalInfoOk returns a tuple with the AdditionalInfo field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAdditionalInfo + +`func (o *User) SetAdditionalInfo(v string)` + +SetAdditionalInfo sets AdditionalInfo field to given value. + +### HasAdditionalInfo + +`func (o *User) HasAdditionalInfo() bool` + +HasAdditionalInfo returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/UserAPIsApi.md b/server/common/sftpgo/v2/openapi/docs/UserAPIsApi.md new file mode 100644 index 00000000..957b45ed --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/UserAPIsApi.md @@ -0,0 +1,1964 @@ +# \UserAPIsApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddShare**](UserAPIsApi.md#AddShare) | **Post** /user/shares | Add a share +[**ChangeUserPassword**](UserAPIsApi.md#ChangeUserPassword) | **Put** /user/changepwd | Change user password +[**CreateUserDir**](UserAPIsApi.md#CreateUserDir) | **Post** /user/dirs | Create a directory +[**CreateUserFile**](UserAPIsApi.md#CreateUserFile) | **Post** /user/files/upload | Upload a single file +[**CreateUserFiles**](UserAPIsApi.md#CreateUserFiles) | **Post** /user/files | Upload files +[**DeleteUserDir**](UserAPIsApi.md#DeleteUserDir) | **Delete** /user/dirs | Delete a directory +[**DeleteUserFile**](UserAPIsApi.md#DeleteUserFile) | **Delete** /user/files | Delete a file +[**DeleteUserShare**](UserAPIsApi.md#DeleteUserShare) | **Delete** /user/shares/{id} | Delete share +[**DownloadUserFile**](UserAPIsApi.md#DownloadUserFile) | **Get** /user/files | Download a single file +[**GenerateUserRecoveryCodes**](UserAPIsApi.md#GenerateUserRecoveryCodes) | **Post** /user/2fa/recoverycodes | Generate recovery codes +[**GenerateUserTotpSecret**](UserAPIsApi.md#GenerateUserTotpSecret) | **Post** /user/totp/generate | Generate a new TOTP secret +[**GetUserDirContents**](UserAPIsApi.md#GetUserDirContents) | **Get** /user/dirs | Read directory contents +[**GetUserFile**](UserAPIsApi.md#GetUserFile) | **Get** /user/file | Download a single file +[**GetUserFolderContents**](UserAPIsApi.md#GetUserFolderContents) | **Get** /user/folder | Read folders contents +[**GetUserProfile**](UserAPIsApi.md#GetUserProfile) | **Get** /user/profile | Get user profile +[**GetUserPublicKeys**](UserAPIsApi.md#GetUserPublicKeys) | **Get** /user/publickeys | Get the user's public keys +[**GetUserRecoveryCodes**](UserAPIsApi.md#GetUserRecoveryCodes) | **Get** /user/2fa/recoverycodes | Get recovery codes +[**GetUserShareById**](UserAPIsApi.md#GetUserShareById) | **Get** /user/shares/{id} | Get share by id +[**GetUserShares**](UserAPIsApi.md#GetUserShares) | **Get** /user/shares | List user shares +[**GetUserTotpConfigs**](UserAPIsApi.md#GetUserTotpConfigs) | **Get** /user/totp/configs | Get available TOTP configuration +[**RenameUserDir**](UserAPIsApi.md#RenameUserDir) | **Patch** /user/dirs | Rename a directory +[**RenameUserFile**](UserAPIsApi.md#RenameUserFile) | **Patch** /user/files | Rename a file +[**SaveUserTotpConfig**](UserAPIsApi.md#SaveUserTotpConfig) | **Post** /user/totp/save | Save a TOTP config +[**SetUserPublicKeys**](UserAPIsApi.md#SetUserPublicKeys) | **Put** /user/publickeys | Set the user's public keys +[**SetpropsUserFile**](UserAPIsApi.md#SetpropsUserFile) | **Patch** /user/files/metadata | Set metadata for a file/directory +[**Streamzip**](UserAPIsApi.md#Streamzip) | **Post** /user/streamzip | Download multiple files and folders as a single zip file +[**UpdateUserProfile**](UserAPIsApi.md#UpdateUserProfile) | **Put** /user/profile | Update user profile +[**UpdateUserShare**](UserAPIsApi.md#UpdateUserShare) | **Put** /user/shares/{id} | Update share +[**ValidateUserTotpSecret**](UserAPIsApi.md#ValidateUserTotpSecret) | **Post** /user/totp/validate | Validate a one time authentication code + + + +## AddShare + +> ApiResponse AddShare(ctx).Share(share).Execute() + +Add a share + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + share := *openapiclient.NewShare() // Share | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.AddShare(context.Background()).Share(share).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.AddShare``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AddShare`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.AddShare`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddShareRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **share** | [**Share**](Share.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ChangeUserPassword + +> ApiResponse ChangeUserPassword(ctx).PwdChange(pwdChange).Execute() + +Change user password + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + pwdChange := *openapiclient.NewPwdChange() // PwdChange | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.ChangeUserPassword(context.Background()).PwdChange(pwdChange).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.ChangeUserPassword``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ChangeUserPassword`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.ChangeUserPassword`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiChangeUserPasswordRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pwdChange** | [**PwdChange**](PwdChange.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateUserDir + +> []ApiResponse CreateUserDir(ctx).Path(path).MkdirParents(mkdirParents).Execute() + +Create a directory + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Path to the folder to create. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" + mkdirParents := true // bool | Create parent directories if they do not exist? (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.CreateUserDir(context.Background()).Path(path).MkdirParents(mkdirParents).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.CreateUserDir``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateUserDir`: []ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.CreateUserDir`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUserDirRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Path to the folder to create. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" | + **mkdirParents** | **bool** | Create parent directories if they do not exist? | + +### Return type + +[**[]ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateUserFile + +> []ApiResponse CreateUserFile(ctx).Path(path).Body(body).MkdirParents(mkdirParents).XSFTPGOMTIME(xSFTPGOMTIME).Execute() + +Upload a single file + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Full file path. It must be path encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\". The parent directory must exist. If a file with the same name already exists, it will be overwritten + body := os.NewFile(1234, "some_file") // *os.File | + mkdirParents := true // bool | Create parent directories if they do not exist? (optional) + xSFTPGOMTIME := int32(56) // int32 | File modification time as unix timestamp in milliseconds (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.CreateUserFile(context.Background()).Path(path).Body(body).MkdirParents(mkdirParents).XSFTPGOMTIME(xSFTPGOMTIME).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.CreateUserFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateUserFile`: []ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.CreateUserFile`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUserFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Full file path. It must be path encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\". The parent directory must exist. If a file with the same name already exists, it will be overwritten | + **body** | ***os.File** | | + **mkdirParents** | **bool** | Create parent directories if they do not exist? | + **xSFTPGOMTIME** | **int32** | File modification time as unix timestamp in milliseconds | + +### Return type + +[**[]ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/_*, text/_*, image/_*, audio/_*, video/_* +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateUserFiles + +> []ApiResponse CreateUserFiles(ctx).Path(path).MkdirParents(mkdirParents).Filenames(filenames).Execute() + +Upload files + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Parent directory for the uploaded files. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root path is assumed. If a file with the same name already exists, it will be overwritten (optional) + mkdirParents := true // bool | Create parent directories if they do not exist? (optional) + filenames := []*os.File{"TODO"} // []*os.File | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.CreateUserFiles(context.Background()).Path(path).MkdirParents(mkdirParents).Filenames(filenames).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.CreateUserFiles``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateUserFiles`: []ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.CreateUserFiles`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUserFilesRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Parent directory for the uploaded files. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root path is assumed. If a file with the same name already exists, it will be overwritten | + **mkdirParents** | **bool** | Create parent directories if they do not exist? | + **filenames** | **[]*os.File** | | + +### Return type + +[**[]ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteUserDir + +> []ApiResponse DeleteUserDir(ctx).Path(path).Execute() + +Delete a directory + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Path to the folder to delete. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.DeleteUserDir(context.Background()).Path(path).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.DeleteUserDir``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DeleteUserDir`: []ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.DeleteUserDir`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteUserDirRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Path to the folder to delete. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" | + +### Return type + +[**[]ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteUserFile + +> []ApiResponse DeleteUserFile(ctx).Path(path).Execute() + +Delete a file + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Path to the file to delete. It must be URL encoded + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.DeleteUserFile(context.Background()).Path(path).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.DeleteUserFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DeleteUserFile`: []ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.DeleteUserFile`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteUserFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Path to the file to delete. It must be URL encoded | + +### Return type + +[**[]ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteUserShare + +> ApiResponse DeleteUserShare(ctx, id).Execute() + +Delete share + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | the share id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.DeleteUserShare(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.DeleteUserShare``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DeleteUserShare`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.DeleteUserShare`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | the share id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteUserShareRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DownloadUserFile + +> *os.File DownloadUserFile(ctx).Path(path).Inline(inline).Execute() + +Download a single file + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Path to the file to download. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" + inline := "inline_example" // string | If set, the response will not have the Content-Disposition header set to `attachment` (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.DownloadUserFile(context.Background()).Path(path).Inline(inline).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.DownloadUserFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DownloadUserFile`: *os.File + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.DownloadUserFile`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiDownloadUserFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Path to the file to download. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" | + **inline** | **string** | If set, the response will not have the Content-Disposition header set to `attachment` | + +### Return type + +[***os.File**](*os.File.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */*, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GenerateUserRecoveryCodes + +> []string GenerateUserRecoveryCodes(ctx).Execute() + +Generate recovery codes + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.GenerateUserRecoveryCodes(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.GenerateUserRecoveryCodes``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GenerateUserRecoveryCodes`: []string + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.GenerateUserRecoveryCodes`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGenerateUserRecoveryCodesRequest struct via the builder pattern + + +### Return type + +**[]string** + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GenerateUserTotpSecret + +> InlineResponse200 GenerateUserTotpSecret(ctx).InlineObject6(inlineObject6).Execute() + +Generate a new TOTP secret + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + inlineObject6 := *openapiclient.NewInlineObject6() // InlineObject6 | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.GenerateUserTotpSecret(context.Background()).InlineObject6(inlineObject6).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.GenerateUserTotpSecret``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GenerateUserTotpSecret`: InlineResponse200 + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.GenerateUserTotpSecret`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGenerateUserTotpSecretRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **inlineObject6** | [**InlineObject6**](InlineObject6.md) | | + +### Return type + +[**InlineResponse200**](InlineResponse200.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserDirContents + +> []DirEntry GetUserDirContents(ctx).Path(path).Execute() + +Read directory contents + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Path to the folder to read. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root folder is assumed (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.GetUserDirContents(context.Background()).Path(path).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.GetUserDirContents``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserDirContents`: []DirEntry + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.GetUserDirContents`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserDirContentsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Path to the folder to read. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root folder is assumed | + +### Return type + +[**[]DirEntry**](DirEntry.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserFile + +> *os.File GetUserFile(ctx).Path(path).Execute() + +Download a single file + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Path to the file to download. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.GetUserFile(context.Background()).Path(path).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.GetUserFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserFile`: *os.File + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.GetUserFile`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Path to the file to download. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" | + +### Return type + +[***os.File**](*os.File.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */*, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserFolderContents + +> []DirEntry GetUserFolderContents(ctx).Path(path).Execute() + +Read folders contents + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Path to the folder to read. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root folder is assumed (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.GetUserFolderContents(context.Background()).Path(path).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.GetUserFolderContents``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserFolderContents`: []DirEntry + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.GetUserFolderContents`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserFolderContentsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Path to the folder to read. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\". If empty or missing the root folder is assumed | + +### Return type + +[**[]DirEntry**](DirEntry.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserProfile + +> UserProfile GetUserProfile(ctx).Execute() + +Get user profile + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.GetUserProfile(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.GetUserProfile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserProfile`: UserProfile + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.GetUserProfile`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserProfileRequest struct via the builder pattern + + +### Return type + +[**UserProfile**](UserProfile.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserPublicKeys + +> []string GetUserPublicKeys(ctx).Execute() + +Get the user's public keys + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.GetUserPublicKeys(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.GetUserPublicKeys``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserPublicKeys`: []string + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.GetUserPublicKeys`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserPublicKeysRequest struct via the builder pattern + + +### Return type + +**[]string** + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserRecoveryCodes + +> []RecoveryCode GetUserRecoveryCodes(ctx).Execute() + +Get recovery codes + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.GetUserRecoveryCodes(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.GetUserRecoveryCodes``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserRecoveryCodes`: []RecoveryCode + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.GetUserRecoveryCodes`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserRecoveryCodesRequest struct via the builder pattern + + +### Return type + +[**[]RecoveryCode**](RecoveryCode.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserShareById + +> Share GetUserShareById(ctx, id).Execute() + +Get share by id + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | the share id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.GetUserShareById(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.GetUserShareById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserShareById`: Share + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.GetUserShareById`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | the share id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserShareByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Share**](Share.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserShares + +> []Share GetUserShares(ctx).Offset(offset).Limit(limit).Order(order).Execute() + +List user shares + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + offset := int32(56) // int32 | (optional) (default to 0) + limit := int32(56) // int32 | The maximum number of items to return. Max value is 500, default is 100 (optional) (default to 100) + order := "ASC" // string | Ordering shares by ID. Default ASC (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.GetUserShares(context.Background()).Offset(offset).Limit(limit).Order(order).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.GetUserShares``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserShares`: []Share + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.GetUserShares`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserSharesRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **offset** | **int32** | | [default to 0] + **limit** | **int32** | The maximum number of items to return. Max value is 500, default is 100 | [default to 100] + **order** | **string** | Ordering shares by ID. Default ASC | + +### Return type + +[**[]Share**](Share.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserTotpConfigs + +> []TOTPConfig GetUserTotpConfigs(ctx).Execute() + +Get available TOTP configuration + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.GetUserTotpConfigs(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.GetUserTotpConfigs``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserTotpConfigs`: []TOTPConfig + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.GetUserTotpConfigs`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserTotpConfigsRequest struct via the builder pattern + + +### Return type + +[**[]TOTPConfig**](TOTPConfig.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## RenameUserDir + +> []ApiResponse RenameUserDir(ctx).Path(path).Target(target).Execute() + +Rename a directory + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Path to the folder to rename. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" + target := "target_example" // string | New name. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.RenameUserDir(context.Background()).Path(path).Target(target).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.RenameUserDir``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `RenameUserDir`: []ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.RenameUserDir`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiRenameUserDirRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Path to the folder to rename. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" | + **target** | **string** | New name. It must be URL encoded, for example the path \"my dir/àdir\" must be sent as \"my%20dir%2F%C3%A0dir\" | + +### Return type + +[**[]ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## RenameUserFile + +> []ApiResponse RenameUserFile(ctx).Path(path).Target(target).Execute() + +Rename a file + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Path to the file to rename. It must be URL encoded + target := "target_example" // string | New name. It must be URL encoded + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.RenameUserFile(context.Background()).Path(path).Target(target).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.RenameUserFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `RenameUserFile`: []ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.RenameUserFile`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiRenameUserFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Path to the file to rename. It must be URL encoded | + **target** | **string** | New name. It must be URL encoded | + +### Return type + +[**[]ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SaveUserTotpConfig + +> ApiResponse SaveUserTotpConfig(ctx).UserTOTPConfig(userTOTPConfig).Execute() + +Save a TOTP config + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + userTOTPConfig := *openapiclient.NewUserTOTPConfig() // UserTOTPConfig | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.SaveUserTotpConfig(context.Background()).UserTOTPConfig(userTOTPConfig).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.SaveUserTotpConfig``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `SaveUserTotpConfig`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.SaveUserTotpConfig`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiSaveUserTotpConfigRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **userTOTPConfig** | [**UserTOTPConfig**](UserTOTPConfig.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SetUserPublicKeys + +> ApiResponse SetUserPublicKeys(ctx).RequestBody(requestBody).Execute() + +Set the user's public keys + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + requestBody := []string{"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPVILdH2u3yV5SAeE6XksD1z1vXRg0E4hJUov8ITDAZ2 user@host"} // []string | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.SetUserPublicKeys(context.Background()).RequestBody(requestBody).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.SetUserPublicKeys``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `SetUserPublicKeys`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.SetUserPublicKeys`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiSetUserPublicKeysRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | **[]string** | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SetpropsUserFile + +> []ApiResponse SetpropsUserFile(ctx).Path(path).InlineObject9(inlineObject9).Execute() + +Set metadata for a file/directory + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + path := "path_example" // string | Full file/directory path. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" + inlineObject9 := *openapiclient.NewInlineObject9() // InlineObject9 | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.SetpropsUserFile(context.Background()).Path(path).InlineObject9(inlineObject9).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.SetpropsUserFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `SetpropsUserFile`: []ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.SetpropsUserFile`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiSetpropsUserFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path** | **string** | Full file/directory path. It must be URL encoded, for example the path \"my dir/àdir/file.txt\" must be sent as \"my%20dir%2F%C3%A0dir%2Ffile.txt\" | + **inlineObject9** | [**InlineObject9**](InlineObject9.md) | | + +### Return type + +[**[]ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## Streamzip + +> *os.File Streamzip(ctx).RequestBody(requestBody).Execute() + +Download multiple files and folders as a single zip file + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + requestBody := []string{"Property_example"} // []string | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.Streamzip(context.Background()).RequestBody(requestBody).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.Streamzip``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Streamzip`: *os.File + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.Streamzip`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiStreamzipRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | **[]string** | | + +### Return type + +[***os.File**](*os.File.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/zip, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateUserProfile + +> ApiResponse UpdateUserProfile(ctx).UserProfile(userProfile).Execute() + +Update user profile + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + userProfile := *openapiclient.NewUserProfile() // UserProfile | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.UpdateUserProfile(context.Background()).UserProfile(userProfile).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.UpdateUserProfile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateUserProfile`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.UpdateUserProfile`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateUserProfileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **userProfile** | [**UserProfile**](UserProfile.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateUserShare + +> ApiResponse UpdateUserShare(ctx, id).Share(share).Execute() + +Update share + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + id := "id_example" // string | the share id + share := *openapiclient.NewShare() // Share | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.UpdateUserShare(context.Background(), id).Share(share).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.UpdateUserShare``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateUserShare`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.UpdateUserShare`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | the share id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateUserShareRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **share** | [**Share**](Share.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ValidateUserTotpSecret + +> ApiResponse ValidateUserTotpSecret(ctx).InlineObject7(inlineObject7).Execute() + +Validate a one time authentication code + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + inlineObject7 := *openapiclient.NewInlineObject7() // InlineObject7 | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UserAPIsApi.ValidateUserTotpSecret(context.Background()).InlineObject7(inlineObject7).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserAPIsApi.ValidateUserTotpSecret``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ValidateUserTotpSecret`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UserAPIsApi.ValidateUserTotpSecret`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiValidateUserTotpSecretRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **inlineObject7** | [**InlineObject7**](InlineObject7.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/UserFilters.md b/server/common/sftpgo/v2/openapi/docs/UserFilters.md new file mode 100644 index 00000000..7834348d --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/UserFilters.md @@ -0,0 +1,446 @@ +# UserFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AllowedIp** | Pointer to **[]string** | only clients connecting from these IP/Mask are allowed. IP/Mask must be in CIDR notation as defined in RFC 4632 and RFC 4291, for example \"192.0.2.0/24\" or \"2001:db8::/32\" | [optional] +**DeniedIp** | Pointer to **[]string** | clients connecting from these IP/Mask are not allowed. Denied rules are evaluated before allowed ones | [optional] +**DeniedLoginMethods** | Pointer to [**[]LoginMethods**](LoginMethods.md) | if null or empty any available login method is allowed | [optional] +**DeniedProtocols** | Pointer to [**[]SupportedProtocols**](SupportedProtocols.md) | if null or empty any available protocol is allowed | [optional] +**FilePatterns** | Pointer to [**[]PatternsFilter**](PatternsFilter.md) | filters based on shell like file patterns. These restrictions do not apply to files listing for performance reasons, so a denied file cannot be downloaded/overwritten/renamed but it will still be in the list of files. Please note that these restrictions can be easily bypassed | [optional] +**MaxUploadFileSize** | Pointer to **int64** | maximum allowed size, as bytes, for a single file upload. The upload will be aborted if/when the size of the file being sent exceeds this limit. 0 means unlimited. This restriction does not apply for SSH system commands such as `git` and `rsync` | [optional] +**TlsUsername** | Pointer to **string** | defines the TLS certificate field to use as username. For FTP clients it must match the name provided using the \"USER\" command. For WebDAV, if no username is provided, the CN will be used as username. For WebDAV clients it must match the implicit or provided username. Ignored if mutual TLS is disabled | [optional] +**Hooks** | Pointer to [**HooksFilter**](HooksFilter.md) | | [optional] +**DisableFsChecks** | Pointer to **bool** | Disable checks for existence and automatic creation of home directory and virtual folders. SFTPGo requires that the user's home directory, virtual folder root, and intermediate paths to virtual folders exist to work properly. If you already know that the required directories exist, disabling these checks will speed up login. You could, for example, disable these checks after the first login | [optional] +**WebClient** | Pointer to [**[]WebClientOptions**](WebClientOptions.md) | WebClient/user REST API related configuration options | [optional] +**AllowApiKeyAuth** | Pointer to **bool** | API key authentication allows to impersonate this user with an API key | [optional] +**UserType** | Pointer to [**UserType**](UserType.md) | | [optional] +**TotpConfig** | Pointer to [**UserTOTPConfig**](UserTOTPConfig.md) | | [optional] +**RecoveryCodes** | Pointer to [**[]RecoveryCode**](RecoveryCode.md) | | [optional] +**BandwidthLimits** | Pointer to [**[]BandwidthLimit**](BandwidthLimit.md) | | [optional] +**DataTransferLimits** | Pointer to [**[]DataTransferLimit**](DataTransferLimit.md) | | [optional] + +## Methods + +### NewUserFilters + +`func NewUserFilters() *UserFilters` + +NewUserFilters instantiates a new UserFilters object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUserFiltersWithDefaults + +`func NewUserFiltersWithDefaults() *UserFilters` + +NewUserFiltersWithDefaults instantiates a new UserFilters object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAllowedIp + +`func (o *UserFilters) GetAllowedIp() []string` + +GetAllowedIp returns the AllowedIp field if non-nil, zero value otherwise. + +### GetAllowedIpOk + +`func (o *UserFilters) GetAllowedIpOk() (*[]string, bool)` + +GetAllowedIpOk returns a tuple with the AllowedIp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAllowedIp + +`func (o *UserFilters) SetAllowedIp(v []string)` + +SetAllowedIp sets AllowedIp field to given value. + +### HasAllowedIp + +`func (o *UserFilters) HasAllowedIp() bool` + +HasAllowedIp returns a boolean if a field has been set. + +### GetDeniedIp + +`func (o *UserFilters) GetDeniedIp() []string` + +GetDeniedIp returns the DeniedIp field if non-nil, zero value otherwise. + +### GetDeniedIpOk + +`func (o *UserFilters) GetDeniedIpOk() (*[]string, bool)` + +GetDeniedIpOk returns a tuple with the DeniedIp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeniedIp + +`func (o *UserFilters) SetDeniedIp(v []string)` + +SetDeniedIp sets DeniedIp field to given value. + +### HasDeniedIp + +`func (o *UserFilters) HasDeniedIp() bool` + +HasDeniedIp returns a boolean if a field has been set. + +### GetDeniedLoginMethods + +`func (o *UserFilters) GetDeniedLoginMethods() []LoginMethods` + +GetDeniedLoginMethods returns the DeniedLoginMethods field if non-nil, zero value otherwise. + +### GetDeniedLoginMethodsOk + +`func (o *UserFilters) GetDeniedLoginMethodsOk() (*[]LoginMethods, bool)` + +GetDeniedLoginMethodsOk returns a tuple with the DeniedLoginMethods field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeniedLoginMethods + +`func (o *UserFilters) SetDeniedLoginMethods(v []LoginMethods)` + +SetDeniedLoginMethods sets DeniedLoginMethods field to given value. + +### HasDeniedLoginMethods + +`func (o *UserFilters) HasDeniedLoginMethods() bool` + +HasDeniedLoginMethods returns a boolean if a field has been set. + +### GetDeniedProtocols + +`func (o *UserFilters) GetDeniedProtocols() []SupportedProtocols` + +GetDeniedProtocols returns the DeniedProtocols field if non-nil, zero value otherwise. + +### GetDeniedProtocolsOk + +`func (o *UserFilters) GetDeniedProtocolsOk() (*[]SupportedProtocols, bool)` + +GetDeniedProtocolsOk returns a tuple with the DeniedProtocols field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeniedProtocols + +`func (o *UserFilters) SetDeniedProtocols(v []SupportedProtocols)` + +SetDeniedProtocols sets DeniedProtocols field to given value. + +### HasDeniedProtocols + +`func (o *UserFilters) HasDeniedProtocols() bool` + +HasDeniedProtocols returns a boolean if a field has been set. + +### GetFilePatterns + +`func (o *UserFilters) GetFilePatterns() []PatternsFilter` + +GetFilePatterns returns the FilePatterns field if non-nil, zero value otherwise. + +### GetFilePatternsOk + +`func (o *UserFilters) GetFilePatternsOk() (*[]PatternsFilter, bool)` + +GetFilePatternsOk returns a tuple with the FilePatterns field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilePatterns + +`func (o *UserFilters) SetFilePatterns(v []PatternsFilter)` + +SetFilePatterns sets FilePatterns field to given value. + +### HasFilePatterns + +`func (o *UserFilters) HasFilePatterns() bool` + +HasFilePatterns returns a boolean if a field has been set. + +### GetMaxUploadFileSize + +`func (o *UserFilters) GetMaxUploadFileSize() int64` + +GetMaxUploadFileSize returns the MaxUploadFileSize field if non-nil, zero value otherwise. + +### GetMaxUploadFileSizeOk + +`func (o *UserFilters) GetMaxUploadFileSizeOk() (*int64, bool)` + +GetMaxUploadFileSizeOk returns a tuple with the MaxUploadFileSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaxUploadFileSize + +`func (o *UserFilters) SetMaxUploadFileSize(v int64)` + +SetMaxUploadFileSize sets MaxUploadFileSize field to given value. + +### HasMaxUploadFileSize + +`func (o *UserFilters) HasMaxUploadFileSize() bool` + +HasMaxUploadFileSize returns a boolean if a field has been set. + +### GetTlsUsername + +`func (o *UserFilters) GetTlsUsername() string` + +GetTlsUsername returns the TlsUsername field if non-nil, zero value otherwise. + +### GetTlsUsernameOk + +`func (o *UserFilters) GetTlsUsernameOk() (*string, bool)` + +GetTlsUsernameOk returns a tuple with the TlsUsername field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTlsUsername + +`func (o *UserFilters) SetTlsUsername(v string)` + +SetTlsUsername sets TlsUsername field to given value. + +### HasTlsUsername + +`func (o *UserFilters) HasTlsUsername() bool` + +HasTlsUsername returns a boolean if a field has been set. + +### GetHooks + +`func (o *UserFilters) GetHooks() HooksFilter` + +GetHooks returns the Hooks field if non-nil, zero value otherwise. + +### GetHooksOk + +`func (o *UserFilters) GetHooksOk() (*HooksFilter, bool)` + +GetHooksOk returns a tuple with the Hooks field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHooks + +`func (o *UserFilters) SetHooks(v HooksFilter)` + +SetHooks sets Hooks field to given value. + +### HasHooks + +`func (o *UserFilters) HasHooks() bool` + +HasHooks returns a boolean if a field has been set. + +### GetDisableFsChecks + +`func (o *UserFilters) GetDisableFsChecks() bool` + +GetDisableFsChecks returns the DisableFsChecks field if non-nil, zero value otherwise. + +### GetDisableFsChecksOk + +`func (o *UserFilters) GetDisableFsChecksOk() (*bool, bool)` + +GetDisableFsChecksOk returns a tuple with the DisableFsChecks field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDisableFsChecks + +`func (o *UserFilters) SetDisableFsChecks(v bool)` + +SetDisableFsChecks sets DisableFsChecks field to given value. + +### HasDisableFsChecks + +`func (o *UserFilters) HasDisableFsChecks() bool` + +HasDisableFsChecks returns a boolean if a field has been set. + +### GetWebClient + +`func (o *UserFilters) GetWebClient() []WebClientOptions` + +GetWebClient returns the WebClient field if non-nil, zero value otherwise. + +### GetWebClientOk + +`func (o *UserFilters) GetWebClientOk() (*[]WebClientOptions, bool)` + +GetWebClientOk returns a tuple with the WebClient field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetWebClient + +`func (o *UserFilters) SetWebClient(v []WebClientOptions)` + +SetWebClient sets WebClient field to given value. + +### HasWebClient + +`func (o *UserFilters) HasWebClient() bool` + +HasWebClient returns a boolean if a field has been set. + +### GetAllowApiKeyAuth + +`func (o *UserFilters) GetAllowApiKeyAuth() bool` + +GetAllowApiKeyAuth returns the AllowApiKeyAuth field if non-nil, zero value otherwise. + +### GetAllowApiKeyAuthOk + +`func (o *UserFilters) GetAllowApiKeyAuthOk() (*bool, bool)` + +GetAllowApiKeyAuthOk returns a tuple with the AllowApiKeyAuth field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAllowApiKeyAuth + +`func (o *UserFilters) SetAllowApiKeyAuth(v bool)` + +SetAllowApiKeyAuth sets AllowApiKeyAuth field to given value. + +### HasAllowApiKeyAuth + +`func (o *UserFilters) HasAllowApiKeyAuth() bool` + +HasAllowApiKeyAuth returns a boolean if a field has been set. + +### GetUserType + +`func (o *UserFilters) GetUserType() UserType` + +GetUserType returns the UserType field if non-nil, zero value otherwise. + +### GetUserTypeOk + +`func (o *UserFilters) GetUserTypeOk() (*UserType, bool)` + +GetUserTypeOk returns a tuple with the UserType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUserType + +`func (o *UserFilters) SetUserType(v UserType)` + +SetUserType sets UserType field to given value. + +### HasUserType + +`func (o *UserFilters) HasUserType() bool` + +HasUserType returns a boolean if a field has been set. + +### GetTotpConfig + +`func (o *UserFilters) GetTotpConfig() UserTOTPConfig` + +GetTotpConfig returns the TotpConfig field if non-nil, zero value otherwise. + +### GetTotpConfigOk + +`func (o *UserFilters) GetTotpConfigOk() (*UserTOTPConfig, bool)` + +GetTotpConfigOk returns a tuple with the TotpConfig field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotpConfig + +`func (o *UserFilters) SetTotpConfig(v UserTOTPConfig)` + +SetTotpConfig sets TotpConfig field to given value. + +### HasTotpConfig + +`func (o *UserFilters) HasTotpConfig() bool` + +HasTotpConfig returns a boolean if a field has been set. + +### GetRecoveryCodes + +`func (o *UserFilters) GetRecoveryCodes() []RecoveryCode` + +GetRecoveryCodes returns the RecoveryCodes field if non-nil, zero value otherwise. + +### GetRecoveryCodesOk + +`func (o *UserFilters) GetRecoveryCodesOk() (*[]RecoveryCode, bool)` + +GetRecoveryCodesOk returns a tuple with the RecoveryCodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRecoveryCodes + +`func (o *UserFilters) SetRecoveryCodes(v []RecoveryCode)` + +SetRecoveryCodes sets RecoveryCodes field to given value. + +### HasRecoveryCodes + +`func (o *UserFilters) HasRecoveryCodes() bool` + +HasRecoveryCodes returns a boolean if a field has been set. + +### GetBandwidthLimits + +`func (o *UserFilters) GetBandwidthLimits() []BandwidthLimit` + +GetBandwidthLimits returns the BandwidthLimits field if non-nil, zero value otherwise. + +### GetBandwidthLimitsOk + +`func (o *UserFilters) GetBandwidthLimitsOk() (*[]BandwidthLimit, bool)` + +GetBandwidthLimitsOk returns a tuple with the BandwidthLimits field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBandwidthLimits + +`func (o *UserFilters) SetBandwidthLimits(v []BandwidthLimit)` + +SetBandwidthLimits sets BandwidthLimits field to given value. + +### HasBandwidthLimits + +`func (o *UserFilters) HasBandwidthLimits() bool` + +HasBandwidthLimits returns a boolean if a field has been set. + +### GetDataTransferLimits + +`func (o *UserFilters) GetDataTransferLimits() []DataTransferLimit` + +GetDataTransferLimits returns the DataTransferLimits field if non-nil, zero value otherwise. + +### GetDataTransferLimitsOk + +`func (o *UserFilters) GetDataTransferLimitsOk() (*[]DataTransferLimit, bool)` + +GetDataTransferLimitsOk returns a tuple with the DataTransferLimits field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDataTransferLimits + +`func (o *UserFilters) SetDataTransferLimits(v []DataTransferLimit)` + +SetDataTransferLimits sets DataTransferLimits field to given value. + +### HasDataTransferLimits + +`func (o *UserFilters) HasDataTransferLimits() bool` + +HasDataTransferLimits returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/UserProfile.md b/server/common/sftpgo/v2/openapi/docs/UserProfile.md new file mode 100644 index 00000000..276aee47 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/UserProfile.md @@ -0,0 +1,134 @@ +# UserProfile + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Email** | Pointer to **string** | | [optional] +**Description** | Pointer to **string** | | [optional] +**AllowApiKeyAuth** | Pointer to **bool** | If enabled, you can impersonate this user, in REST API, using an API key. If disabled user credentials are required for impersonation | [optional] +**PublicKeys** | Pointer to **[]string** | | [optional] + +## Methods + +### NewUserProfile + +`func NewUserProfile() *UserProfile` + +NewUserProfile instantiates a new UserProfile object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUserProfileWithDefaults + +`func NewUserProfileWithDefaults() *UserProfile` + +NewUserProfileWithDefaults instantiates a new UserProfile object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetEmail + +`func (o *UserProfile) GetEmail() string` + +GetEmail returns the Email field if non-nil, zero value otherwise. + +### GetEmailOk + +`func (o *UserProfile) GetEmailOk() (*string, bool)` + +GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEmail + +`func (o *UserProfile) SetEmail(v string)` + +SetEmail sets Email field to given value. + +### HasEmail + +`func (o *UserProfile) HasEmail() bool` + +HasEmail returns a boolean if a field has been set. + +### GetDescription + +`func (o *UserProfile) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *UserProfile) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *UserProfile) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *UserProfile) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetAllowApiKeyAuth + +`func (o *UserProfile) GetAllowApiKeyAuth() bool` + +GetAllowApiKeyAuth returns the AllowApiKeyAuth field if non-nil, zero value otherwise. + +### GetAllowApiKeyAuthOk + +`func (o *UserProfile) GetAllowApiKeyAuthOk() (*bool, bool)` + +GetAllowApiKeyAuthOk returns a tuple with the AllowApiKeyAuth field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAllowApiKeyAuth + +`func (o *UserProfile) SetAllowApiKeyAuth(v bool)` + +SetAllowApiKeyAuth sets AllowApiKeyAuth field to given value. + +### HasAllowApiKeyAuth + +`func (o *UserProfile) HasAllowApiKeyAuth() bool` + +HasAllowApiKeyAuth returns a boolean if a field has been set. + +### GetPublicKeys + +`func (o *UserProfile) GetPublicKeys() []string` + +GetPublicKeys returns the PublicKeys field if non-nil, zero value otherwise. + +### GetPublicKeysOk + +`func (o *UserProfile) GetPublicKeysOk() (*[]string, bool)` + +GetPublicKeysOk returns a tuple with the PublicKeys field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicKeys + +`func (o *UserProfile) SetPublicKeys(v []string)` + +SetPublicKeys sets PublicKeys field to given value. + +### HasPublicKeys + +`func (o *UserProfile) HasPublicKeys() bool` + +HasPublicKeys returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/UserTOTPConfig.md b/server/common/sftpgo/v2/openapi/docs/UserTOTPConfig.md new file mode 100644 index 00000000..30213a1c --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/UserTOTPConfig.md @@ -0,0 +1,134 @@ +# UserTOTPConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Enabled** | Pointer to **bool** | | [optional] +**ConfigName** | Pointer to **string** | This name must be defined within the \"totp\" section of the SFTPGo configuration file. You will be unable to save a user/admin referencing a missing config_name | [optional] +**Secret** | Pointer to [**Secret**](Secret.md) | | [optional] +**Protocols** | Pointer to [**[]MFAProtocols**](MFAProtocols.md) | TOTP will be required for the specified protocols. SSH protocol (SFTP/SCP/SSH commands) will ask for the TOTP passcode if the client uses keyboard interactive authentication. FTP has no standard way to support two factor authentication, if you enable the FTP support, you have to add the TOTP passcode after the password. For example if your password is \"password\" and your one time passcode is \"123456\" you have to use \"password123456\" as password. WebDAV is not supported since each single request must be authenticated and a passcode cannot be reused. | [optional] + +## Methods + +### NewUserTOTPConfig + +`func NewUserTOTPConfig() *UserTOTPConfig` + +NewUserTOTPConfig instantiates a new UserTOTPConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUserTOTPConfigWithDefaults + +`func NewUserTOTPConfigWithDefaults() *UserTOTPConfig` + +NewUserTOTPConfigWithDefaults instantiates a new UserTOTPConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetEnabled + +`func (o *UserTOTPConfig) GetEnabled() bool` + +GetEnabled returns the Enabled field if non-nil, zero value otherwise. + +### GetEnabledOk + +`func (o *UserTOTPConfig) GetEnabledOk() (*bool, bool)` + +GetEnabledOk returns a tuple with the Enabled field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnabled + +`func (o *UserTOTPConfig) SetEnabled(v bool)` + +SetEnabled sets Enabled field to given value. + +### HasEnabled + +`func (o *UserTOTPConfig) HasEnabled() bool` + +HasEnabled returns a boolean if a field has been set. + +### GetConfigName + +`func (o *UserTOTPConfig) GetConfigName() string` + +GetConfigName returns the ConfigName field if non-nil, zero value otherwise. + +### GetConfigNameOk + +`func (o *UserTOTPConfig) GetConfigNameOk() (*string, bool)` + +GetConfigNameOk returns a tuple with the ConfigName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfigName + +`func (o *UserTOTPConfig) SetConfigName(v string)` + +SetConfigName sets ConfigName field to given value. + +### HasConfigName + +`func (o *UserTOTPConfig) HasConfigName() bool` + +HasConfigName returns a boolean if a field has been set. + +### GetSecret + +`func (o *UserTOTPConfig) GetSecret() Secret` + +GetSecret returns the Secret field if non-nil, zero value otherwise. + +### GetSecretOk + +`func (o *UserTOTPConfig) GetSecretOk() (*Secret, bool)` + +GetSecretOk returns a tuple with the Secret field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSecret + +`func (o *UserTOTPConfig) SetSecret(v Secret)` + +SetSecret sets Secret field to given value. + +### HasSecret + +`func (o *UserTOTPConfig) HasSecret() bool` + +HasSecret returns a boolean if a field has been set. + +### GetProtocols + +`func (o *UserTOTPConfig) GetProtocols() []MFAProtocols` + +GetProtocols returns the Protocols field if non-nil, zero value otherwise. + +### GetProtocolsOk + +`func (o *UserTOTPConfig) GetProtocolsOk() (*[]MFAProtocols, bool)` + +GetProtocolsOk returns a tuple with the Protocols field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProtocols + +`func (o *UserTOTPConfig) SetProtocols(v []MFAProtocols)` + +SetProtocols sets Protocols field to given value. + +### HasProtocols + +`func (o *UserTOTPConfig) HasProtocols() bool` + +HasProtocols returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/UserTOTPConfigAllOf.md b/server/common/sftpgo/v2/openapi/docs/UserTOTPConfigAllOf.md new file mode 100644 index 00000000..0a84b6a7 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/UserTOTPConfigAllOf.md @@ -0,0 +1,56 @@ +# UserTOTPConfigAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Protocols** | Pointer to [**[]MFAProtocols**](MFAProtocols.md) | TOTP will be required for the specified protocols. SSH protocol (SFTP/SCP/SSH commands) will ask for the TOTP passcode if the client uses keyboard interactive authentication. FTP has no standard way to support two factor authentication, if you enable the FTP support, you have to add the TOTP passcode after the password. For example if your password is \"password\" and your one time passcode is \"123456\" you have to use \"password123456\" as password. WebDAV is not supported since each single request must be authenticated and a passcode cannot be reused. | [optional] + +## Methods + +### NewUserTOTPConfigAllOf + +`func NewUserTOTPConfigAllOf() *UserTOTPConfigAllOf` + +NewUserTOTPConfigAllOf instantiates a new UserTOTPConfigAllOf object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUserTOTPConfigAllOfWithDefaults + +`func NewUserTOTPConfigAllOfWithDefaults() *UserTOTPConfigAllOf` + +NewUserTOTPConfigAllOfWithDefaults instantiates a new UserTOTPConfigAllOf object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetProtocols + +`func (o *UserTOTPConfigAllOf) GetProtocols() []MFAProtocols` + +GetProtocols returns the Protocols field if non-nil, zero value otherwise. + +### GetProtocolsOk + +`func (o *UserTOTPConfigAllOf) GetProtocolsOk() (*[]MFAProtocols, bool)` + +GetProtocolsOk returns a tuple with the Protocols field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProtocols + +`func (o *UserTOTPConfigAllOf) SetProtocols(v []MFAProtocols)` + +SetProtocols sets Protocols field to given value. + +### HasProtocols + +`func (o *UserTOTPConfigAllOf) HasProtocols() bool` + +HasProtocols returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/UserType.md b/server/common/sftpgo/v2/openapi/docs/UserType.md new file mode 100644 index 00000000..f7d9fbfa --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/UserType.md @@ -0,0 +1,15 @@ +# UserType + +## Enum + + +* `EMPTY` (value: `""`) + +* `LDAP_USER` (value: `"LDAPUser"`) + +* `OS_USER` (value: `"OSUser"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/UsersApi.md b/server/common/sftpgo/v2/openapi/docs/UsersApi.md new file mode 100644 index 00000000..d5d8c628 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/UsersApi.md @@ -0,0 +1,578 @@ +# \UsersApi + +All URIs are relative to */api/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddUser**](UsersApi.md#AddUser) | **Post** /users | Add user +[**DeleteUser**](UsersApi.md#DeleteUser) | **Delete** /users/{username} | Delete user +[**DisableUser2fa**](UsersApi.md#DisableUser2fa) | **Put** /users/{username}/2fa/disable | Disable second factor authentication +[**GetUserByUsername**](UsersApi.md#GetUserByUsername) | **Get** /users/{username} | Find users by username +[**GetUsers**](UsersApi.md#GetUsers) | **Get** /users | Get users +[**UpdateUser**](UsersApi.md#UpdateUser) | **Put** /users/{username} | Update user +[**UserForgotPassword**](UsersApi.md#UserForgotPassword) | **Post** /users/{username}/forgot-password | Send a password reset code by email +[**UserResetPassword**](UsersApi.md#UserResetPassword) | **Post** /users/{username}/reset-password | Reset the password + + + +## AddUser + +> User AddUser(ctx).User(user).Execute() + +Add user + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + user := *openapiclient.NewUser() // User | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.AddUser(context.Background()).User(user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.AddUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AddUser`: User + fmt.Fprintf(os.Stdout, "Response from `UsersApi.AddUser`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md) | | + +### Return type + +[**User**](User.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteUser + +> ApiResponse DeleteUser(ctx, username).Execute() + +Delete user + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.DeleteUser(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.DeleteUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DeleteUser`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UsersApi.DeleteUser`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DisableUser2fa + +> ApiResponse DisableUser2fa(ctx, username).Execute() + +Disable second factor authentication + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.DisableUser2fa(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.DisableUser2fa``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DisableUser2fa`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UsersApi.DisableUser2fa`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDisableUser2faRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserByUsername + +> User GetUserByUsername(ctx, username).Execute() + +Find users by username + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.GetUserByUsername(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.GetUserByUsername``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserByUsername`: User + fmt.Fprintf(os.Stdout, "Response from `UsersApi.GetUserByUsername`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserByUsernameRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**User**](User.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUsers + +> []User GetUsers(ctx).Offset(offset).Limit(limit).Order(order).Execute() + +Get users + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + offset := int32(56) // int32 | (optional) (default to 0) + limit := int32(56) // int32 | The maximum number of items to return. Max value is 500, default is 100 (optional) (default to 100) + order := "ASC" // string | Ordering users by username. Default ASC (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.GetUsers(context.Background()).Offset(offset).Limit(limit).Order(order).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.GetUsers``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUsers`: []User + fmt.Fprintf(os.Stdout, "Response from `UsersApi.GetUsers`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUsersRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **offset** | **int32** | | [default to 0] + **limit** | **int32** | The maximum number of items to return. Max value is 500, default is 100 | [default to 100] + **order** | **string** | Ordering users by username. Default ASC | + +### Return type + +[**[]User**](User.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateUser + +> ApiResponse UpdateUser(ctx, username).User(user).Disconnect(disconnect).Execute() + +Update user + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the username + user := *openapiclient.NewUser() // User | + disconnect := int32(56) // int32 | Disconnect: * `0` The user will not be disconnected and it will continue to use the old configuration until connected. This is the default * `1` The user will be disconnected after a successful update. It must login again and so it will be forced to use the new configuration (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.UpdateUser(context.Background(), username).User(user).Disconnect(disconnect).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.UpdateUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateUser`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UsersApi.UpdateUser`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **user** | [**User**](User.md) | | + **disconnect** | **int32** | Disconnect: * `0` The user will not be disconnected and it will continue to use the old configuration until connected. This is the default * `1` The user will be disconnected after a successful update. It must login again and so it will be forced to use the new configuration | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[APIKeyAuth](../README.md#APIKeyAuth), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UserForgotPassword + +> ApiResponse UserForgotPassword(ctx, username).Execute() + +Send a password reset code by email + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.UserForgotPassword(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.UserForgotPassword``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UserForgotPassword`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UsersApi.UserForgotPassword`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUserForgotPasswordRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UserResetPassword + +> ApiResponse UserResetPassword(ctx, username).InlineObject5(inlineObject5).Execute() + +Reset the password + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | the username + inlineObject5 := *openapiclient.NewInlineObject5() // InlineObject5 | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.UserResetPassword(context.Background(), username).InlineObject5(inlineObject5).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.UserResetPassword``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UserResetPassword`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `UsersApi.UserResetPassword`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | the username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUserResetPasswordRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **inlineObject5** | [**InlineObject5**](InlineObject5.md) | | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/server/common/sftpgo/v2/openapi/docs/VersionInfo.md b/server/common/sftpgo/v2/openapi/docs/VersionInfo.md new file mode 100644 index 00000000..9688b903 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/VersionInfo.md @@ -0,0 +1,134 @@ +# VersionInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Version** | Pointer to **string** | | [optional] +**BuildDate** | Pointer to **string** | | [optional] +**CommitHash** | Pointer to **string** | | [optional] +**Features** | Pointer to **[]string** | Features for the current build. Available features are \"portable\", \"bolt\", \"mysql\", \"sqlite\", \"pgsql\", \"s3\", \"gcs\", \"metrics\". If a feature is available it has a \"+\" prefix, otherwise a \"-\" prefix | [optional] + +## Methods + +### NewVersionInfo + +`func NewVersionInfo() *VersionInfo` + +NewVersionInfo instantiates a new VersionInfo object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewVersionInfoWithDefaults + +`func NewVersionInfoWithDefaults() *VersionInfo` + +NewVersionInfoWithDefaults instantiates a new VersionInfo object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetVersion + +`func (o *VersionInfo) GetVersion() string` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *VersionInfo) GetVersionOk() (*string, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *VersionInfo) SetVersion(v string)` + +SetVersion sets Version field to given value. + +### HasVersion + +`func (o *VersionInfo) HasVersion() bool` + +HasVersion returns a boolean if a field has been set. + +### GetBuildDate + +`func (o *VersionInfo) GetBuildDate() string` + +GetBuildDate returns the BuildDate field if non-nil, zero value otherwise. + +### GetBuildDateOk + +`func (o *VersionInfo) GetBuildDateOk() (*string, bool)` + +GetBuildDateOk returns a tuple with the BuildDate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBuildDate + +`func (o *VersionInfo) SetBuildDate(v string)` + +SetBuildDate sets BuildDate field to given value. + +### HasBuildDate + +`func (o *VersionInfo) HasBuildDate() bool` + +HasBuildDate returns a boolean if a field has been set. + +### GetCommitHash + +`func (o *VersionInfo) GetCommitHash() string` + +GetCommitHash returns the CommitHash field if non-nil, zero value otherwise. + +### GetCommitHashOk + +`func (o *VersionInfo) GetCommitHashOk() (*string, bool)` + +GetCommitHashOk returns a tuple with the CommitHash field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCommitHash + +`func (o *VersionInfo) SetCommitHash(v string)` + +SetCommitHash sets CommitHash field to given value. + +### HasCommitHash + +`func (o *VersionInfo) HasCommitHash() bool` + +HasCommitHash returns a boolean if a field has been set. + +### GetFeatures + +`func (o *VersionInfo) GetFeatures() []string` + +GetFeatures returns the Features field if non-nil, zero value otherwise. + +### GetFeaturesOk + +`func (o *VersionInfo) GetFeaturesOk() (*[]string, bool)` + +GetFeaturesOk returns a tuple with the Features field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFeatures + +`func (o *VersionInfo) SetFeatures(v []string)` + +SetFeatures sets Features field to given value. + +### HasFeatures + +`func (o *VersionInfo) HasFeatures() bool` + +HasFeatures returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/VirtualFolder.md b/server/common/sftpgo/v2/openapi/docs/VirtualFolder.md new file mode 100644 index 00000000..8e2473bd --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/VirtualFolder.md @@ -0,0 +1,337 @@ +# VirtualFolder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int32** | | [optional] +**Name** | Pointer to **string** | unique name for this virtual folder | [optional] +**MappedPath** | Pointer to **string** | absolute filesystem path to use as virtual folder | [optional] +**Description** | Pointer to **string** | optional description | [optional] +**UsedQuotaSize** | Pointer to **int64** | | [optional] +**UsedQuotaFiles** | Pointer to **int32** | | [optional] +**LastQuotaUpdate** | Pointer to **int64** | Last quota update as unix timestamp in milliseconds | [optional] +**Users** | Pointer to **[]string** | list of usernames associated with this virtual folder | [optional] +**Filesystem** | Pointer to [**FilesystemConfig**](FilesystemConfig.md) | | [optional] +**VirtualPath** | **string** | | +**QuotaSize** | Pointer to **int64** | Quota as size in bytes. 0 menas unlimited, -1 means included in user quota. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed | [optional] +**QuotaFiles** | Pointer to **int32** | Quota as number of files. 0 menas unlimited, , -1 means included in user quota. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed | [optional] + +## Methods + +### NewVirtualFolder + +`func NewVirtualFolder(virtualPath string, ) *VirtualFolder` + +NewVirtualFolder instantiates a new VirtualFolder object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewVirtualFolderWithDefaults + +`func NewVirtualFolderWithDefaults() *VirtualFolder` + +NewVirtualFolderWithDefaults instantiates a new VirtualFolder object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *VirtualFolder) GetId() int32` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *VirtualFolder) GetIdOk() (*int32, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *VirtualFolder) SetId(v int32)` + +SetId sets Id field to given value. + +### HasId + +`func (o *VirtualFolder) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetName + +`func (o *VirtualFolder) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *VirtualFolder) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *VirtualFolder) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *VirtualFolder) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetMappedPath + +`func (o *VirtualFolder) GetMappedPath() string` + +GetMappedPath returns the MappedPath field if non-nil, zero value otherwise. + +### GetMappedPathOk + +`func (o *VirtualFolder) GetMappedPathOk() (*string, bool)` + +GetMappedPathOk returns a tuple with the MappedPath field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMappedPath + +`func (o *VirtualFolder) SetMappedPath(v string)` + +SetMappedPath sets MappedPath field to given value. + +### HasMappedPath + +`func (o *VirtualFolder) HasMappedPath() bool` + +HasMappedPath returns a boolean if a field has been set. + +### GetDescription + +`func (o *VirtualFolder) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *VirtualFolder) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *VirtualFolder) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *VirtualFolder) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetUsedQuotaSize + +`func (o *VirtualFolder) GetUsedQuotaSize() int64` + +GetUsedQuotaSize returns the UsedQuotaSize field if non-nil, zero value otherwise. + +### GetUsedQuotaSizeOk + +`func (o *VirtualFolder) GetUsedQuotaSizeOk() (*int64, bool)` + +GetUsedQuotaSizeOk returns a tuple with the UsedQuotaSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedQuotaSize + +`func (o *VirtualFolder) SetUsedQuotaSize(v int64)` + +SetUsedQuotaSize sets UsedQuotaSize field to given value. + +### HasUsedQuotaSize + +`func (o *VirtualFolder) HasUsedQuotaSize() bool` + +HasUsedQuotaSize returns a boolean if a field has been set. + +### GetUsedQuotaFiles + +`func (o *VirtualFolder) GetUsedQuotaFiles() int32` + +GetUsedQuotaFiles returns the UsedQuotaFiles field if non-nil, zero value otherwise. + +### GetUsedQuotaFilesOk + +`func (o *VirtualFolder) GetUsedQuotaFilesOk() (*int32, bool)` + +GetUsedQuotaFilesOk returns a tuple with the UsedQuotaFiles field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsedQuotaFiles + +`func (o *VirtualFolder) SetUsedQuotaFiles(v int32)` + +SetUsedQuotaFiles sets UsedQuotaFiles field to given value. + +### HasUsedQuotaFiles + +`func (o *VirtualFolder) HasUsedQuotaFiles() bool` + +HasUsedQuotaFiles returns a boolean if a field has been set. + +### GetLastQuotaUpdate + +`func (o *VirtualFolder) GetLastQuotaUpdate() int64` + +GetLastQuotaUpdate returns the LastQuotaUpdate field if non-nil, zero value otherwise. + +### GetLastQuotaUpdateOk + +`func (o *VirtualFolder) GetLastQuotaUpdateOk() (*int64, bool)` + +GetLastQuotaUpdateOk returns a tuple with the LastQuotaUpdate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastQuotaUpdate + +`func (o *VirtualFolder) SetLastQuotaUpdate(v int64)` + +SetLastQuotaUpdate sets LastQuotaUpdate field to given value. + +### HasLastQuotaUpdate + +`func (o *VirtualFolder) HasLastQuotaUpdate() bool` + +HasLastQuotaUpdate returns a boolean if a field has been set. + +### GetUsers + +`func (o *VirtualFolder) GetUsers() []string` + +GetUsers returns the Users field if non-nil, zero value otherwise. + +### GetUsersOk + +`func (o *VirtualFolder) GetUsersOk() (*[]string, bool)` + +GetUsersOk returns a tuple with the Users field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsers + +`func (o *VirtualFolder) SetUsers(v []string)` + +SetUsers sets Users field to given value. + +### HasUsers + +`func (o *VirtualFolder) HasUsers() bool` + +HasUsers returns a boolean if a field has been set. + +### GetFilesystem + +`func (o *VirtualFolder) GetFilesystem() FilesystemConfig` + +GetFilesystem returns the Filesystem field if non-nil, zero value otherwise. + +### GetFilesystemOk + +`func (o *VirtualFolder) GetFilesystemOk() (*FilesystemConfig, bool)` + +GetFilesystemOk returns a tuple with the Filesystem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilesystem + +`func (o *VirtualFolder) SetFilesystem(v FilesystemConfig)` + +SetFilesystem sets Filesystem field to given value. + +### HasFilesystem + +`func (o *VirtualFolder) HasFilesystem() bool` + +HasFilesystem returns a boolean if a field has been set. + +### GetVirtualPath + +`func (o *VirtualFolder) GetVirtualPath() string` + +GetVirtualPath returns the VirtualPath field if non-nil, zero value otherwise. + +### GetVirtualPathOk + +`func (o *VirtualFolder) GetVirtualPathOk() (*string, bool)` + +GetVirtualPathOk returns a tuple with the VirtualPath field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVirtualPath + +`func (o *VirtualFolder) SetVirtualPath(v string)` + +SetVirtualPath sets VirtualPath field to given value. + + +### GetQuotaSize + +`func (o *VirtualFolder) GetQuotaSize() int64` + +GetQuotaSize returns the QuotaSize field if non-nil, zero value otherwise. + +### GetQuotaSizeOk + +`func (o *VirtualFolder) GetQuotaSizeOk() (*int64, bool)` + +GetQuotaSizeOk returns a tuple with the QuotaSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuotaSize + +`func (o *VirtualFolder) SetQuotaSize(v int64)` + +SetQuotaSize sets QuotaSize field to given value. + +### HasQuotaSize + +`func (o *VirtualFolder) HasQuotaSize() bool` + +HasQuotaSize returns a boolean if a field has been set. + +### GetQuotaFiles + +`func (o *VirtualFolder) GetQuotaFiles() int32` + +GetQuotaFiles returns the QuotaFiles field if non-nil, zero value otherwise. + +### GetQuotaFilesOk + +`func (o *VirtualFolder) GetQuotaFilesOk() (*int32, bool)` + +GetQuotaFilesOk returns a tuple with the QuotaFiles field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuotaFiles + +`func (o *VirtualFolder) SetQuotaFiles(v int32)` + +SetQuotaFiles sets QuotaFiles field to given value. + +### HasQuotaFiles + +`func (o *VirtualFolder) HasQuotaFiles() bool` + +HasQuotaFiles returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/VirtualFolderAllOf.md b/server/common/sftpgo/v2/openapi/docs/VirtualFolderAllOf.md new file mode 100644 index 00000000..e1910d54 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/VirtualFolderAllOf.md @@ -0,0 +1,103 @@ +# VirtualFolderAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VirtualPath** | **string** | | +**QuotaSize** | Pointer to **int64** | Quota as size in bytes. 0 menas unlimited, -1 means included in user quota. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed | [optional] +**QuotaFiles** | Pointer to **int32** | Quota as number of files. 0 menas unlimited, , -1 means included in user quota. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed | [optional] + +## Methods + +### NewVirtualFolderAllOf + +`func NewVirtualFolderAllOf(virtualPath string, ) *VirtualFolderAllOf` + +NewVirtualFolderAllOf instantiates a new VirtualFolderAllOf object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewVirtualFolderAllOfWithDefaults + +`func NewVirtualFolderAllOfWithDefaults() *VirtualFolderAllOf` + +NewVirtualFolderAllOfWithDefaults instantiates a new VirtualFolderAllOf object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetVirtualPath + +`func (o *VirtualFolderAllOf) GetVirtualPath() string` + +GetVirtualPath returns the VirtualPath field if non-nil, zero value otherwise. + +### GetVirtualPathOk + +`func (o *VirtualFolderAllOf) GetVirtualPathOk() (*string, bool)` + +GetVirtualPathOk returns a tuple with the VirtualPath field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVirtualPath + +`func (o *VirtualFolderAllOf) SetVirtualPath(v string)` + +SetVirtualPath sets VirtualPath field to given value. + + +### GetQuotaSize + +`func (o *VirtualFolderAllOf) GetQuotaSize() int64` + +GetQuotaSize returns the QuotaSize field if non-nil, zero value otherwise. + +### GetQuotaSizeOk + +`func (o *VirtualFolderAllOf) GetQuotaSizeOk() (*int64, bool)` + +GetQuotaSizeOk returns a tuple with the QuotaSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuotaSize + +`func (o *VirtualFolderAllOf) SetQuotaSize(v int64)` + +SetQuotaSize sets QuotaSize field to given value. + +### HasQuotaSize + +`func (o *VirtualFolderAllOf) HasQuotaSize() bool` + +HasQuotaSize returns a boolean if a field has been set. + +### GetQuotaFiles + +`func (o *VirtualFolderAllOf) GetQuotaFiles() int32` + +GetQuotaFiles returns the QuotaFiles field if non-nil, zero value otherwise. + +### GetQuotaFilesOk + +`func (o *VirtualFolderAllOf) GetQuotaFilesOk() (*int32, bool)` + +GetQuotaFilesOk returns a tuple with the QuotaFiles field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuotaFiles + +`func (o *VirtualFolderAllOf) SetQuotaFiles(v int32)` + +SetQuotaFiles sets QuotaFiles field to given value. + +### HasQuotaFiles + +`func (o *VirtualFolderAllOf) HasQuotaFiles() bool` + +HasQuotaFiles returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/WebClientOptions.md b/server/common/sftpgo/v2/openapi/docs/WebClientOptions.md new file mode 100644 index 00000000..e0d85f6f --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/WebClientOptions.md @@ -0,0 +1,25 @@ +# WebClientOptions + +## Enum + + +* `PUBLICKEY_CHANGE_DISABLED` (value: `"publickey-change-disabled"`) + +* `WRITE_DISABLED` (value: `"write-disabled"`) + +* `MFA_DISABLED` (value: `"mfa-disabled"`) + +* `PASSWORD_CHANGE_DISABLED` (value: `"password-change-disabled"`) + +* `API_KEY_AUTH_CHANGE_DISABLED` (value: `"api-key-auth-change-disabled"`) + +* `INFO_CHANGE_DISABLED` (value: `"info-change-disabled"`) + +* `SHARES_DISABLED` (value: `"shares-disabled"`) + +* `PASSWORD_RESET_DISABLED` (value: `"password-reset-disabled"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/WebDAVBinding.md b/server/common/sftpgo/v2/openapi/docs/WebDAVBinding.md new file mode 100644 index 00000000..5ed6afac --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/WebDAVBinding.md @@ -0,0 +1,134 @@ +# WebDAVBinding + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Address** | Pointer to **string** | TCP address the server listen on | [optional] +**Port** | Pointer to **int32** | the port used for serving requests | [optional] +**EnableHttps** | Pointer to **bool** | | [optional] +**ClientAuthType** | Pointer to **int32** | 1 means that client certificate authentication is required in addition to HTTP basic authentication | [optional] + +## Methods + +### NewWebDAVBinding + +`func NewWebDAVBinding() *WebDAVBinding` + +NewWebDAVBinding instantiates a new WebDAVBinding object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewWebDAVBindingWithDefaults + +`func NewWebDAVBindingWithDefaults() *WebDAVBinding` + +NewWebDAVBindingWithDefaults instantiates a new WebDAVBinding object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAddress + +`func (o *WebDAVBinding) GetAddress() string` + +GetAddress returns the Address field if non-nil, zero value otherwise. + +### GetAddressOk + +`func (o *WebDAVBinding) GetAddressOk() (*string, bool)` + +GetAddressOk returns a tuple with the Address field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAddress + +`func (o *WebDAVBinding) SetAddress(v string)` + +SetAddress sets Address field to given value. + +### HasAddress + +`func (o *WebDAVBinding) HasAddress() bool` + +HasAddress returns a boolean if a field has been set. + +### GetPort + +`func (o *WebDAVBinding) GetPort() int32` + +GetPort returns the Port field if non-nil, zero value otherwise. + +### GetPortOk + +`func (o *WebDAVBinding) GetPortOk() (*int32, bool)` + +GetPortOk returns a tuple with the Port field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPort + +`func (o *WebDAVBinding) SetPort(v int32)` + +SetPort sets Port field to given value. + +### HasPort + +`func (o *WebDAVBinding) HasPort() bool` + +HasPort returns a boolean if a field has been set. + +### GetEnableHttps + +`func (o *WebDAVBinding) GetEnableHttps() bool` + +GetEnableHttps returns the EnableHttps field if non-nil, zero value otherwise. + +### GetEnableHttpsOk + +`func (o *WebDAVBinding) GetEnableHttpsOk() (*bool, bool)` + +GetEnableHttpsOk returns a tuple with the EnableHttps field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnableHttps + +`func (o *WebDAVBinding) SetEnableHttps(v bool)` + +SetEnableHttps sets EnableHttps field to given value. + +### HasEnableHttps + +`func (o *WebDAVBinding) HasEnableHttps() bool` + +HasEnableHttps returns a boolean if a field has been set. + +### GetClientAuthType + +`func (o *WebDAVBinding) GetClientAuthType() int32` + +GetClientAuthType returns the ClientAuthType field if non-nil, zero value otherwise. + +### GetClientAuthTypeOk + +`func (o *WebDAVBinding) GetClientAuthTypeOk() (*int32, bool)` + +GetClientAuthTypeOk returns a tuple with the ClientAuthType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClientAuthType + +`func (o *WebDAVBinding) SetClientAuthType(v int32)` + +SetClientAuthType sets ClientAuthType field to given value. + +### HasClientAuthType + +`func (o *WebDAVBinding) HasClientAuthType() bool` + +HasClientAuthType returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/docs/WebDAVServiceStatus.md b/server/common/sftpgo/v2/openapi/docs/WebDAVServiceStatus.md new file mode 100644 index 00000000..ad7c4bd4 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/docs/WebDAVServiceStatus.md @@ -0,0 +1,92 @@ +# WebDAVServiceStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**IsActive** | Pointer to **bool** | | [optional] +**Bindings** | Pointer to [**[]WebDAVBinding**](WebDAVBinding.md) | | [optional] + +## Methods + +### NewWebDAVServiceStatus + +`func NewWebDAVServiceStatus() *WebDAVServiceStatus` + +NewWebDAVServiceStatus instantiates a new WebDAVServiceStatus object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewWebDAVServiceStatusWithDefaults + +`func NewWebDAVServiceStatusWithDefaults() *WebDAVServiceStatus` + +NewWebDAVServiceStatusWithDefaults instantiates a new WebDAVServiceStatus object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIsActive + +`func (o *WebDAVServiceStatus) GetIsActive() bool` + +GetIsActive returns the IsActive field if non-nil, zero value otherwise. + +### GetIsActiveOk + +`func (o *WebDAVServiceStatus) GetIsActiveOk() (*bool, bool)` + +GetIsActiveOk returns a tuple with the IsActive field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsActive + +`func (o *WebDAVServiceStatus) SetIsActive(v bool)` + +SetIsActive sets IsActive field to given value. + +### HasIsActive + +`func (o *WebDAVServiceStatus) HasIsActive() bool` + +HasIsActive returns a boolean if a field has been set. + +### GetBindings + +`func (o *WebDAVServiceStatus) GetBindings() []WebDAVBinding` + +GetBindings returns the Bindings field if non-nil, zero value otherwise. + +### GetBindingsOk + +`func (o *WebDAVServiceStatus) GetBindingsOk() (*[]WebDAVBinding, bool)` + +GetBindingsOk returns a tuple with the Bindings field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBindings + +`func (o *WebDAVServiceStatus) SetBindings(v []WebDAVBinding)` + +SetBindings sets Bindings field to given value. + +### HasBindings + +`func (o *WebDAVServiceStatus) HasBindings() bool` + +HasBindings returns a boolean if a field has been set. + +### SetBindingsNil + +`func (o *WebDAVServiceStatus) SetBindingsNil(b bool)` + + SetBindingsNil sets the value for Bindings to be an explicit nil + +### UnsetBindings +`func (o *WebDAVServiceStatus) UnsetBindings()` + +UnsetBindings ensures that no value is present for Bindings, not even an explicit nil + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/server/common/sftpgo/v2/openapi/git_push.sh b/server/common/sftpgo/v2/openapi/git_push.sh new file mode 100644 index 00000000..de6a48dd --- /dev/null +++ b/server/common/sftpgo/v2/openapi/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="hasusuf" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="sftpgo-client" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/server/common/sftpgo/v2/openapi/model_admin.go b/server/common/sftpgo/v2/openapi/model_admin.go new file mode 100644 index 00000000..82136b5a --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_admin.go @@ -0,0 +1,519 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// Admin struct for Admin +type Admin struct { + Id *int32 `json:"id,omitempty"` + // status: * `0` user is disabled, login is not allowed * `1` user is enabled + Status *int32 `json:"status,omitempty"` + // username is unique + Username *string `json:"username,omitempty"` + // optional description, for example the admin full name + Description *string `json:"description,omitempty"` + // Admin password. For security reasons this field is omitted when you search/get admins + Password *string `json:"password,omitempty"` + Email *string `json:"email,omitempty"` + Permissions []AdminPermissions `json:"permissions,omitempty"` + Filters *AdminFilters `json:"filters,omitempty"` + // Free form text field + AdditionalInfo *string `json:"additional_info,omitempty"` + // creation time as unix timestamp in milliseconds. It will be 0 for admins created before v2.2.0 + CreatedAt *int64 `json:"created_at,omitempty"` + // last update time as unix timestamp in milliseconds + UpdatedAt *int64 `json:"updated_at,omitempty"` + // Last user login as unix timestamp in milliseconds. It is saved at most once every 10 minutes + LastLogin *int64 `json:"last_login,omitempty"` +} + +// NewAdmin instantiates a new Admin object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAdmin() *Admin { + this := Admin{} + return &this +} + +// NewAdminWithDefaults instantiates a new Admin object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAdminWithDefaults() *Admin { + this := Admin{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Admin) GetId() int32 { + if o == nil || o.Id == nil { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetIdOk() (*int32, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Admin) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *Admin) SetId(v int32) { + o.Id = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Admin) GetStatus() int32 { + if o == nil || o.Status == nil { + var ret int32 + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetStatusOk() (*int32, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Admin) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given int32 and assigns it to the Status field. +func (o *Admin) SetStatus(v int32) { + o.Status = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *Admin) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *Admin) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *Admin) SetUsername(v string) { + o.Username = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Admin) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Admin) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Admin) SetDescription(v string) { + o.Description = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *Admin) GetPassword() string { + if o == nil || o.Password == nil { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetPasswordOk() (*string, bool) { + if o == nil || o.Password == nil { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *Admin) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *Admin) SetPassword(v string) { + o.Password = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *Admin) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *Admin) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *Admin) SetEmail(v string) { + o.Email = &v +} + +// GetPermissions returns the Permissions field value if set, zero value otherwise. +func (o *Admin) GetPermissions() []AdminPermissions { + if o == nil || o.Permissions == nil { + var ret []AdminPermissions + return ret + } + return o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetPermissionsOk() ([]AdminPermissions, bool) { + if o == nil || o.Permissions == nil { + return nil, false + } + return o.Permissions, true +} + +// HasPermissions returns a boolean if a field has been set. +func (o *Admin) HasPermissions() bool { + if o != nil && o.Permissions != nil { + return true + } + + return false +} + +// SetPermissions gets a reference to the given []AdminPermissions and assigns it to the Permissions field. +func (o *Admin) SetPermissions(v []AdminPermissions) { + o.Permissions = v +} + +// GetFilters returns the Filters field value if set, zero value otherwise. +func (o *Admin) GetFilters() AdminFilters { + if o == nil || o.Filters == nil { + var ret AdminFilters + return ret + } + return *o.Filters +} + +// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetFiltersOk() (*AdminFilters, bool) { + if o == nil || o.Filters == nil { + return nil, false + } + return o.Filters, true +} + +// HasFilters returns a boolean if a field has been set. +func (o *Admin) HasFilters() bool { + if o != nil && o.Filters != nil { + return true + } + + return false +} + +// SetFilters gets a reference to the given AdminFilters and assigns it to the Filters field. +func (o *Admin) SetFilters(v AdminFilters) { + o.Filters = &v +} + +// GetAdditionalInfo returns the AdditionalInfo field value if set, zero value otherwise. +func (o *Admin) GetAdditionalInfo() string { + if o == nil || o.AdditionalInfo == nil { + var ret string + return ret + } + return *o.AdditionalInfo +} + +// GetAdditionalInfoOk returns a tuple with the AdditionalInfo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetAdditionalInfoOk() (*string, bool) { + if o == nil || o.AdditionalInfo == nil { + return nil, false + } + return o.AdditionalInfo, true +} + +// HasAdditionalInfo returns a boolean if a field has been set. +func (o *Admin) HasAdditionalInfo() bool { + if o != nil && o.AdditionalInfo != nil { + return true + } + + return false +} + +// SetAdditionalInfo gets a reference to the given string and assigns it to the AdditionalInfo field. +func (o *Admin) SetAdditionalInfo(v string) { + o.AdditionalInfo = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Admin) GetCreatedAt() int64 { + if o == nil || o.CreatedAt == nil { + var ret int64 + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetCreatedAtOk() (*int64, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Admin) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. +func (o *Admin) SetCreatedAt(v int64) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Admin) GetUpdatedAt() int64 { + if o == nil || o.UpdatedAt == nil { + var ret int64 + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetUpdatedAtOk() (*int64, bool) { + if o == nil || o.UpdatedAt == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Admin) HasUpdatedAt() bool { + if o != nil && o.UpdatedAt != nil { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given int64 and assigns it to the UpdatedAt field. +func (o *Admin) SetUpdatedAt(v int64) { + o.UpdatedAt = &v +} + +// GetLastLogin returns the LastLogin field value if set, zero value otherwise. +func (o *Admin) GetLastLogin() int64 { + if o == nil || o.LastLogin == nil { + var ret int64 + return ret + } + return *o.LastLogin +} + +// GetLastLoginOk returns a tuple with the LastLogin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Admin) GetLastLoginOk() (*int64, bool) { + if o == nil || o.LastLogin == nil { + return nil, false + } + return o.LastLogin, true +} + +// HasLastLogin returns a boolean if a field has been set. +func (o *Admin) HasLastLogin() bool { + if o != nil && o.LastLogin != nil { + return true + } + + return false +} + +// SetLastLogin gets a reference to the given int64 and assigns it to the LastLogin field. +func (o *Admin) SetLastLogin(v int64) { + o.LastLogin = &v +} + +func (o Admin) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Password != nil { + toSerialize["password"] = o.Password + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Permissions != nil { + toSerialize["permissions"] = o.Permissions + } + if o.Filters != nil { + toSerialize["filters"] = o.Filters + } + if o.AdditionalInfo != nil { + toSerialize["additional_info"] = o.AdditionalInfo + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.UpdatedAt != nil { + toSerialize["updated_at"] = o.UpdatedAt + } + if o.LastLogin != nil { + toSerialize["last_login"] = o.LastLogin + } + return json.Marshal(toSerialize) +} + +type NullableAdmin struct { + value *Admin + isSet bool +} + +func (v NullableAdmin) Get() *Admin { + return v.value +} + +func (v *NullableAdmin) Set(val *Admin) { + v.value = val + v.isSet = true +} + +func (v NullableAdmin) IsSet() bool { + return v.isSet +} + +func (v *NullableAdmin) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdmin(val *Admin) *NullableAdmin { + return &NullableAdmin{value: val, isSet: true} +} + +func (v NullableAdmin) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdmin) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_admin_filters.go b/server/common/sftpgo/v2/openapi/model_admin_filters.go new file mode 100644 index 00000000..598c0e1b --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_admin_filters.go @@ -0,0 +1,225 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// AdminFilters struct for AdminFilters +type AdminFilters struct { + // only clients connecting from these IP/Mask are allowed. IP/Mask must be in CIDR notation as defined in RFC 4632 and RFC 4291, for example \"192.0.2.0/24\" or \"2001:db8::/32\" + AllowList []string `json:"allow_list,omitempty"` + // API key auth allows to impersonate this administrator with an API key + AllowApiKeyAuth *bool `json:"allow_api_key_auth,omitempty"` + TotpConfig *AdminTOTPConfig `json:"totp_config,omitempty"` + RecoveryCodes []RecoveryCode `json:"recovery_codes,omitempty"` +} + +// NewAdminFilters instantiates a new AdminFilters object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAdminFilters() *AdminFilters { + this := AdminFilters{} + return &this +} + +// NewAdminFiltersWithDefaults instantiates a new AdminFilters object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAdminFiltersWithDefaults() *AdminFilters { + this := AdminFilters{} + return &this +} + +// GetAllowList returns the AllowList field value if set, zero value otherwise. +func (o *AdminFilters) GetAllowList() []string { + if o == nil || o.AllowList == nil { + var ret []string + return ret + } + return o.AllowList +} + +// GetAllowListOk returns a tuple with the AllowList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdminFilters) GetAllowListOk() ([]string, bool) { + if o == nil || o.AllowList == nil { + return nil, false + } + return o.AllowList, true +} + +// HasAllowList returns a boolean if a field has been set. +func (o *AdminFilters) HasAllowList() bool { + if o != nil && o.AllowList != nil { + return true + } + + return false +} + +// SetAllowList gets a reference to the given []string and assigns it to the AllowList field. +func (o *AdminFilters) SetAllowList(v []string) { + o.AllowList = v +} + +// GetAllowApiKeyAuth returns the AllowApiKeyAuth field value if set, zero value otherwise. +func (o *AdminFilters) GetAllowApiKeyAuth() bool { + if o == nil || o.AllowApiKeyAuth == nil { + var ret bool + return ret + } + return *o.AllowApiKeyAuth +} + +// GetAllowApiKeyAuthOk returns a tuple with the AllowApiKeyAuth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdminFilters) GetAllowApiKeyAuthOk() (*bool, bool) { + if o == nil || o.AllowApiKeyAuth == nil { + return nil, false + } + return o.AllowApiKeyAuth, true +} + +// HasAllowApiKeyAuth returns a boolean if a field has been set. +func (o *AdminFilters) HasAllowApiKeyAuth() bool { + if o != nil && o.AllowApiKeyAuth != nil { + return true + } + + return false +} + +// SetAllowApiKeyAuth gets a reference to the given bool and assigns it to the AllowApiKeyAuth field. +func (o *AdminFilters) SetAllowApiKeyAuth(v bool) { + o.AllowApiKeyAuth = &v +} + +// GetTotpConfig returns the TotpConfig field value if set, zero value otherwise. +func (o *AdminFilters) GetTotpConfig() AdminTOTPConfig { + if o == nil || o.TotpConfig == nil { + var ret AdminTOTPConfig + return ret + } + return *o.TotpConfig +} + +// GetTotpConfigOk returns a tuple with the TotpConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdminFilters) GetTotpConfigOk() (*AdminTOTPConfig, bool) { + if o == nil || o.TotpConfig == nil { + return nil, false + } + return o.TotpConfig, true +} + +// HasTotpConfig returns a boolean if a field has been set. +func (o *AdminFilters) HasTotpConfig() bool { + if o != nil && o.TotpConfig != nil { + return true + } + + return false +} + +// SetTotpConfig gets a reference to the given AdminTOTPConfig and assigns it to the TotpConfig field. +func (o *AdminFilters) SetTotpConfig(v AdminTOTPConfig) { + o.TotpConfig = &v +} + +// GetRecoveryCodes returns the RecoveryCodes field value if set, zero value otherwise. +func (o *AdminFilters) GetRecoveryCodes() []RecoveryCode { + if o == nil || o.RecoveryCodes == nil { + var ret []RecoveryCode + return ret + } + return o.RecoveryCodes +} + +// GetRecoveryCodesOk returns a tuple with the RecoveryCodes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdminFilters) GetRecoveryCodesOk() ([]RecoveryCode, bool) { + if o == nil || o.RecoveryCodes == nil { + return nil, false + } + return o.RecoveryCodes, true +} + +// HasRecoveryCodes returns a boolean if a field has been set. +func (o *AdminFilters) HasRecoveryCodes() bool { + if o != nil && o.RecoveryCodes != nil { + return true + } + + return false +} + +// SetRecoveryCodes gets a reference to the given []RecoveryCode and assigns it to the RecoveryCodes field. +func (o *AdminFilters) SetRecoveryCodes(v []RecoveryCode) { + o.RecoveryCodes = v +} + +func (o AdminFilters) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.AllowList != nil { + toSerialize["allow_list"] = o.AllowList + } + if o.AllowApiKeyAuth != nil { + toSerialize["allow_api_key_auth"] = o.AllowApiKeyAuth + } + if o.TotpConfig != nil { + toSerialize["totp_config"] = o.TotpConfig + } + if o.RecoveryCodes != nil { + toSerialize["recovery_codes"] = o.RecoveryCodes + } + return json.Marshal(toSerialize) +} + +type NullableAdminFilters struct { + value *AdminFilters + isSet bool +} + +func (v NullableAdminFilters) Get() *AdminFilters { + return v.value +} + +func (v *NullableAdminFilters) Set(val *AdminFilters) { + v.value = val + v.isSet = true +} + +func (v NullableAdminFilters) IsSet() bool { + return v.isSet +} + +func (v *NullableAdminFilters) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdminFilters(val *AdminFilters) *NullableAdminFilters { + return &NullableAdminFilters{value: val, isSet: true} +} + +func (v NullableAdminFilters) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdminFilters) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_admin_permissions.go b/server/common/sftpgo/v2/openapi/model_admin_permissions.go new file mode 100644 index 00000000..1a99ba2f --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_admin_permissions.go @@ -0,0 +1,141 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// AdminPermissions Admin permissions: * `*` - all permissions are granted * `add_users` - add new users is allowed * `edit_users` - change existing users is allowed * `del_users` - remove users is allowed * `view_users` - list users is allowed * `view_conns` - list active connections is allowed * `close_conns` - close active connections is allowed * `view_status` - view the server status is allowed * `manage_admins` - manage other admins is allowed * `manage_apikeys` - manage API keys is allowed * `quota_scans` - view and start quota scans is allowed * `manage_system` - backups and restores are allowed * `manage_defender` - remove ip from the dynamic blocklist is allowed * `view_defender` - list the dynamic blocklist is allowed * `retention_checks` - view and start retention checks is allowed * `metadata_checks` - view and start metadata checks is allowed * `view_events` - view and search filesystem and provider events is allowed +type AdminPermissions string + +// List of AdminPermissions +const ( + ADMINPERMISSIONS_STAR AdminPermissions = "*" + ADMINPERMISSIONS_ADD_USERS AdminPermissions = "add_users" + ADMINPERMISSIONS_EDIT_USERS AdminPermissions = "edit_users" + ADMINPERMISSIONS_DEL_USERS AdminPermissions = "del_users" + ADMINPERMISSIONS_VIEW_USERS AdminPermissions = "view_users" + ADMINPERMISSIONS_VIEW_CONNS AdminPermissions = "view_conns" + ADMINPERMISSIONS_CLOSE_CONNS AdminPermissions = "close_conns" + ADMINPERMISSIONS_VIEW_STATUS AdminPermissions = "view_status" + ADMINPERMISSIONS_MANAGE_ADMINS AdminPermissions = "manage_admins" + ADMINPERMISSIONS_MANAGE_APIKEYS AdminPermissions = "manage_apikeys" + ADMINPERMISSIONS_QUOTA_SCANS AdminPermissions = "quota_scans" + ADMINPERMISSIONS_MANAGE_SYSTEM AdminPermissions = "manage_system" + ADMINPERMISSIONS_MANAGE_DEFENDER AdminPermissions = "manage_defender" + ADMINPERMISSIONS_VIEW_DEFENDER AdminPermissions = "view_defender" + ADMINPERMISSIONS_RETENTION_CHECKS AdminPermissions = "retention_checks" + ADMINPERMISSIONS_METADATA_CHECKS AdminPermissions = "metadata_checks" + ADMINPERMISSIONS_VIEW_EVENTS AdminPermissions = "view_events" +) + +// All allowed values of AdminPermissions enum +var AllowedAdminPermissionsEnumValues = []AdminPermissions{ + "*", + "add_users", + "edit_users", + "del_users", + "view_users", + "view_conns", + "close_conns", + "view_status", + "manage_admins", + "manage_apikeys", + "quota_scans", + "manage_system", + "manage_defender", + "view_defender", + "retention_checks", + "metadata_checks", + "view_events", +} + +func (v *AdminPermissions) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := AdminPermissions(value) + for _, existing := range AllowedAdminPermissionsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid AdminPermissions", value) +} + +// NewAdminPermissionsFromValue returns a pointer to a valid AdminPermissions +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAdminPermissionsFromValue(v string) (*AdminPermissions, error) { + ev := AdminPermissions(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AdminPermissions: valid values are %v", v, AllowedAdminPermissionsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v AdminPermissions) IsValid() bool { + for _, existing := range AllowedAdminPermissionsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AdminPermissions value +func (v AdminPermissions) Ptr() *AdminPermissions { + return &v +} + +type NullableAdminPermissions struct { + value *AdminPermissions + isSet bool +} + +func (v NullableAdminPermissions) Get() *AdminPermissions { + return v.value +} + +func (v *NullableAdminPermissions) Set(val *AdminPermissions) { + v.value = val + v.isSet = true +} + +func (v NullableAdminPermissions) IsSet() bool { + return v.isSet +} + +func (v *NullableAdminPermissions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdminPermissions(val *AdminPermissions) *NullableAdminPermissions { + return &NullableAdminPermissions{value: val, isSet: true} +} + +func (v NullableAdminPermissions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdminPermissions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_admin_profile.go b/server/common/sftpgo/v2/openapi/model_admin_profile.go new file mode 100644 index 00000000..77db9f0e --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_admin_profile.go @@ -0,0 +1,188 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// AdminProfile struct for AdminProfile +type AdminProfile struct { + Email *string `json:"email,omitempty"` + Description *string `json:"description,omitempty"` + // If enabled, you can impersonate this admin, in REST API, using an API key. If disabled admin credentials are required for impersonation + AllowApiKeyAuth *bool `json:"allow_api_key_auth,omitempty"` +} + +// NewAdminProfile instantiates a new AdminProfile object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAdminProfile() *AdminProfile { + this := AdminProfile{} + return &this +} + +// NewAdminProfileWithDefaults instantiates a new AdminProfile object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAdminProfileWithDefaults() *AdminProfile { + this := AdminProfile{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *AdminProfile) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdminProfile) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *AdminProfile) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *AdminProfile) SetEmail(v string) { + o.Email = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AdminProfile) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdminProfile) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *AdminProfile) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AdminProfile) SetDescription(v string) { + o.Description = &v +} + +// GetAllowApiKeyAuth returns the AllowApiKeyAuth field value if set, zero value otherwise. +func (o *AdminProfile) GetAllowApiKeyAuth() bool { + if o == nil || o.AllowApiKeyAuth == nil { + var ret bool + return ret + } + return *o.AllowApiKeyAuth +} + +// GetAllowApiKeyAuthOk returns a tuple with the AllowApiKeyAuth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdminProfile) GetAllowApiKeyAuthOk() (*bool, bool) { + if o == nil || o.AllowApiKeyAuth == nil { + return nil, false + } + return o.AllowApiKeyAuth, true +} + +// HasAllowApiKeyAuth returns a boolean if a field has been set. +func (o *AdminProfile) HasAllowApiKeyAuth() bool { + if o != nil && o.AllowApiKeyAuth != nil { + return true + } + + return false +} + +// SetAllowApiKeyAuth gets a reference to the given bool and assigns it to the AllowApiKeyAuth field. +func (o *AdminProfile) SetAllowApiKeyAuth(v bool) { + o.AllowApiKeyAuth = &v +} + +func (o AdminProfile) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.AllowApiKeyAuth != nil { + toSerialize["allow_api_key_auth"] = o.AllowApiKeyAuth + } + return json.Marshal(toSerialize) +} + +type NullableAdminProfile struct { + value *AdminProfile + isSet bool +} + +func (v NullableAdminProfile) Get() *AdminProfile { + return v.value +} + +func (v *NullableAdminProfile) Set(val *AdminProfile) { + v.value = val + v.isSet = true +} + +func (v NullableAdminProfile) IsSet() bool { + return v.isSet +} + +func (v *NullableAdminProfile) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdminProfile(val *AdminProfile) *NullableAdminProfile { + return &NullableAdminProfile{value: val, isSet: true} +} + +func (v NullableAdminProfile) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdminProfile) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_admin_totp_config.go b/server/common/sftpgo/v2/openapi/model_admin_totp_config.go new file mode 100644 index 00000000..bb1f265b --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_admin_totp_config.go @@ -0,0 +1,188 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// AdminTOTPConfig struct for AdminTOTPConfig +type AdminTOTPConfig struct { + Enabled *bool `json:"enabled,omitempty"` + // This name must be defined within the \"totp\" section of the SFTPGo configuration file. You will be unable to save a user/admin referencing a missing config_name + ConfigName *string `json:"config_name,omitempty"` + Secret *Secret `json:"secret,omitempty"` +} + +// NewAdminTOTPConfig instantiates a new AdminTOTPConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAdminTOTPConfig() *AdminTOTPConfig { + this := AdminTOTPConfig{} + return &this +} + +// NewAdminTOTPConfigWithDefaults instantiates a new AdminTOTPConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAdminTOTPConfigWithDefaults() *AdminTOTPConfig { + this := AdminTOTPConfig{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *AdminTOTPConfig) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdminTOTPConfig) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *AdminTOTPConfig) HasEnabled() bool { + if o != nil && o.Enabled != nil { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *AdminTOTPConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetConfigName returns the ConfigName field value if set, zero value otherwise. +func (o *AdminTOTPConfig) GetConfigName() string { + if o == nil || o.ConfigName == nil { + var ret string + return ret + } + return *o.ConfigName +} + +// GetConfigNameOk returns a tuple with the ConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdminTOTPConfig) GetConfigNameOk() (*string, bool) { + if o == nil || o.ConfigName == nil { + return nil, false + } + return o.ConfigName, true +} + +// HasConfigName returns a boolean if a field has been set. +func (o *AdminTOTPConfig) HasConfigName() bool { + if o != nil && o.ConfigName != nil { + return true + } + + return false +} + +// SetConfigName gets a reference to the given string and assigns it to the ConfigName field. +func (o *AdminTOTPConfig) SetConfigName(v string) { + o.ConfigName = &v +} + +// GetSecret returns the Secret field value if set, zero value otherwise. +func (o *AdminTOTPConfig) GetSecret() Secret { + if o == nil || o.Secret == nil { + var ret Secret + return ret + } + return *o.Secret +} + +// GetSecretOk returns a tuple with the Secret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdminTOTPConfig) GetSecretOk() (*Secret, bool) { + if o == nil || o.Secret == nil { + return nil, false + } + return o.Secret, true +} + +// HasSecret returns a boolean if a field has been set. +func (o *AdminTOTPConfig) HasSecret() bool { + if o != nil && o.Secret != nil { + return true + } + + return false +} + +// SetSecret gets a reference to the given Secret and assigns it to the Secret field. +func (o *AdminTOTPConfig) SetSecret(v Secret) { + o.Secret = &v +} + +func (o AdminTOTPConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.ConfigName != nil { + toSerialize["config_name"] = o.ConfigName + } + if o.Secret != nil { + toSerialize["secret"] = o.Secret + } + return json.Marshal(toSerialize) +} + +type NullableAdminTOTPConfig struct { + value *AdminTOTPConfig + isSet bool +} + +func (v NullableAdminTOTPConfig) Get() *AdminTOTPConfig { + return v.value +} + +func (v *NullableAdminTOTPConfig) Set(val *AdminTOTPConfig) { + v.value = val + v.isSet = true +} + +func (v NullableAdminTOTPConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableAdminTOTPConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdminTOTPConfig(val *AdminTOTPConfig) *NullableAdminTOTPConfig { + return &NullableAdminTOTPConfig{value: val, isSet: true} +} + +func (v NullableAdminTOTPConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdminTOTPConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_api_response.go b/server/common/sftpgo/v2/openapi/model_api_response.go new file mode 100644 index 00000000..f87bc15d --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_api_response.go @@ -0,0 +1,153 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// ApiResponse struct for ApiResponse +type ApiResponse struct { + // message, can be empty + Message *string `json:"message,omitempty"` + // error description if any + Error *string `json:"error,omitempty"` +} + +// NewApiResponse instantiates a new ApiResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewApiResponse() *ApiResponse { + this := ApiResponse{} + return &this +} + +// NewApiResponseWithDefaults instantiates a new ApiResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewApiResponseWithDefaults() *ApiResponse { + this := ApiResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *ApiResponse) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponse) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *ApiResponse) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *ApiResponse) SetMessage(v string) { + o.Message = &v +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *ApiResponse) GetError() string { + if o == nil || o.Error == nil { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponse) GetErrorOk() (*string, bool) { + if o == nil || o.Error == nil { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *ApiResponse) HasError() bool { + if o != nil && o.Error != nil { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *ApiResponse) SetError(v string) { + o.Error = &v +} + +func (o ApiResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Error != nil { + toSerialize["error"] = o.Error + } + return json.Marshal(toSerialize) +} + +type NullableApiResponse struct { + value *ApiResponse + isSet bool +} + +func (v NullableApiResponse) Get() *ApiResponse { + return v.value +} + +func (v *NullableApiResponse) Set(val *ApiResponse) { + v.value = val + v.isSet = true +} + +func (v NullableApiResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableApiResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApiResponse(val *ApiResponse) *NullableApiResponse { + return &NullableApiResponse{value: val, isSet: true} +} + +func (v NullableApiResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApiResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_auth_api_key.go b/server/common/sftpgo/v2/openapi/model_auth_api_key.go new file mode 100644 index 00000000..433d56a2 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_auth_api_key.go @@ -0,0 +1,485 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// AuthAPIKey struct for AuthAPIKey +type AuthAPIKey struct { + // unique key identifier + Id *string `json:"id,omitempty"` + // User friendly key name + Name *string `json:"name,omitempty"` + // We store the hash of the key. This is just like a password. For security reasons this field is omitted when you search/get API keys + Key *string `json:"key,omitempty"` + Scope *AuthAPIKeyScope `json:"scope,omitempty"` + // creation time as unix timestamp in milliseconds + CreatedAt *int64 `json:"created_at,omitempty"` + // last update time as unix timestamp in milliseconds + UpdatedAt *int64 `json:"updated_at,omitempty"` + // last use time as unix timestamp in milliseconds. It is saved at most once every 10 minutes + LastUseAt *int64 `json:"last_use_at,omitempty"` + // expiration time as unix timestamp in milliseconds + ExpiresAt *int64 `json:"expires_at,omitempty"` + // optional description + Description *string `json:"description,omitempty"` + // username associated with this API key. If empty and the scope is \"user scope\" the key can impersonate any user + User *string `json:"user,omitempty"` + // admin associated with this API key. If empty and the scope is \"admin scope\" the key can impersonate any admin + Admin *string `json:"admin,omitempty"` +} + +// NewAuthAPIKey instantiates a new AuthAPIKey object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAuthAPIKey() *AuthAPIKey { + this := AuthAPIKey{} + return &this +} + +// NewAuthAPIKeyWithDefaults instantiates a new AuthAPIKey object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAuthAPIKeyWithDefaults() *AuthAPIKey { + this := AuthAPIKey{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AuthAPIKey) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthAPIKey) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *AuthAPIKey) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AuthAPIKey) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *AuthAPIKey) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthAPIKey) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *AuthAPIKey) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *AuthAPIKey) SetName(v string) { + o.Name = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *AuthAPIKey) GetKey() string { + if o == nil || o.Key == nil { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthAPIKey) GetKeyOk() (*string, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *AuthAPIKey) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *AuthAPIKey) SetKey(v string) { + o.Key = &v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *AuthAPIKey) GetScope() AuthAPIKeyScope { + if o == nil || o.Scope == nil { + var ret AuthAPIKeyScope + return ret + } + return *o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthAPIKey) GetScopeOk() (*AuthAPIKeyScope, bool) { + if o == nil || o.Scope == nil { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *AuthAPIKey) HasScope() bool { + if o != nil && o.Scope != nil { + return true + } + + return false +} + +// SetScope gets a reference to the given AuthAPIKeyScope and assigns it to the Scope field. +func (o *AuthAPIKey) SetScope(v AuthAPIKeyScope) { + o.Scope = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *AuthAPIKey) GetCreatedAt() int64 { + if o == nil || o.CreatedAt == nil { + var ret int64 + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthAPIKey) GetCreatedAtOk() (*int64, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *AuthAPIKey) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. +func (o *AuthAPIKey) SetCreatedAt(v int64) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *AuthAPIKey) GetUpdatedAt() int64 { + if o == nil || o.UpdatedAt == nil { + var ret int64 + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthAPIKey) GetUpdatedAtOk() (*int64, bool) { + if o == nil || o.UpdatedAt == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *AuthAPIKey) HasUpdatedAt() bool { + if o != nil && o.UpdatedAt != nil { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given int64 and assigns it to the UpdatedAt field. +func (o *AuthAPIKey) SetUpdatedAt(v int64) { + o.UpdatedAt = &v +} + +// GetLastUseAt returns the LastUseAt field value if set, zero value otherwise. +func (o *AuthAPIKey) GetLastUseAt() int64 { + if o == nil || o.LastUseAt == nil { + var ret int64 + return ret + } + return *o.LastUseAt +} + +// GetLastUseAtOk returns a tuple with the LastUseAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthAPIKey) GetLastUseAtOk() (*int64, bool) { + if o == nil || o.LastUseAt == nil { + return nil, false + } + return o.LastUseAt, true +} + +// HasLastUseAt returns a boolean if a field has been set. +func (o *AuthAPIKey) HasLastUseAt() bool { + if o != nil && o.LastUseAt != nil { + return true + } + + return false +} + +// SetLastUseAt gets a reference to the given int64 and assigns it to the LastUseAt field. +func (o *AuthAPIKey) SetLastUseAt(v int64) { + o.LastUseAt = &v +} + +// GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. +func (o *AuthAPIKey) GetExpiresAt() int64 { + if o == nil || o.ExpiresAt == nil { + var ret int64 + return ret + } + return *o.ExpiresAt +} + +// GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthAPIKey) GetExpiresAtOk() (*int64, bool) { + if o == nil || o.ExpiresAt == nil { + return nil, false + } + return o.ExpiresAt, true +} + +// HasExpiresAt returns a boolean if a field has been set. +func (o *AuthAPIKey) HasExpiresAt() bool { + if o != nil && o.ExpiresAt != nil { + return true + } + + return false +} + +// SetExpiresAt gets a reference to the given int64 and assigns it to the ExpiresAt field. +func (o *AuthAPIKey) SetExpiresAt(v int64) { + o.ExpiresAt = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AuthAPIKey) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthAPIKey) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *AuthAPIKey) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AuthAPIKey) SetDescription(v string) { + o.Description = &v +} + +// GetUser returns the User field value if set, zero value otherwise. +func (o *AuthAPIKey) GetUser() string { + if o == nil || o.User == nil { + var ret string + return ret + } + return *o.User +} + +// GetUserOk returns a tuple with the User field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthAPIKey) GetUserOk() (*string, bool) { + if o == nil || o.User == nil { + return nil, false + } + return o.User, true +} + +// HasUser returns a boolean if a field has been set. +func (o *AuthAPIKey) HasUser() bool { + if o != nil && o.User != nil { + return true + } + + return false +} + +// SetUser gets a reference to the given string and assigns it to the User field. +func (o *AuthAPIKey) SetUser(v string) { + o.User = &v +} + +// GetAdmin returns the Admin field value if set, zero value otherwise. +func (o *AuthAPIKey) GetAdmin() string { + if o == nil || o.Admin == nil { + var ret string + return ret + } + return *o.Admin +} + +// GetAdminOk returns a tuple with the Admin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthAPIKey) GetAdminOk() (*string, bool) { + if o == nil || o.Admin == nil { + return nil, false + } + return o.Admin, true +} + +// HasAdmin returns a boolean if a field has been set. +func (o *AuthAPIKey) HasAdmin() bool { + if o != nil && o.Admin != nil { + return true + } + + return false +} + +// SetAdmin gets a reference to the given string and assigns it to the Admin field. +func (o *AuthAPIKey) SetAdmin(v string) { + o.Admin = &v +} + +func (o AuthAPIKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + if o.Scope != nil { + toSerialize["scope"] = o.Scope + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.UpdatedAt != nil { + toSerialize["updated_at"] = o.UpdatedAt + } + if o.LastUseAt != nil { + toSerialize["last_use_at"] = o.LastUseAt + } + if o.ExpiresAt != nil { + toSerialize["expires_at"] = o.ExpiresAt + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.User != nil { + toSerialize["user"] = o.User + } + if o.Admin != nil { + toSerialize["admin"] = o.Admin + } + return json.Marshal(toSerialize) +} + +type NullableAuthAPIKey struct { + value *AuthAPIKey + isSet bool +} + +func (v NullableAuthAPIKey) Get() *AuthAPIKey { + return v.value +} + +func (v *NullableAuthAPIKey) Set(val *AuthAPIKey) { + v.value = val + v.isSet = true +} + +func (v NullableAuthAPIKey) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthAPIKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthAPIKey(val *AuthAPIKey) *NullableAuthAPIKey { + return &NullableAuthAPIKey{value: val, isSet: true} +} + +func (v NullableAuthAPIKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthAPIKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_auth_api_key_scope.go b/server/common/sftpgo/v2/openapi/model_auth_api_key_scope.go new file mode 100644 index 00000000..08985e6a --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_auth_api_key_scope.go @@ -0,0 +1,111 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// AuthAPIKeyScope Options: * `1` - admin scope. The API key will be used to impersonate an SFTPGo admin * `2` - user scope. The API key will be used to impersonate an SFTPGo user +type AuthAPIKeyScope int32 + +// List of AuthAPIKeyScope +const ( + AUTHAPIKEYSCOPE__1 AuthAPIKeyScope = 1 + AUTHAPIKEYSCOPE__2 AuthAPIKeyScope = 2 +) + +// All allowed values of AuthAPIKeyScope enum +var AllowedAuthAPIKeyScopeEnumValues = []AuthAPIKeyScope{ + 1, + 2, +} + +func (v *AuthAPIKeyScope) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := AuthAPIKeyScope(value) + for _, existing := range AllowedAuthAPIKeyScopeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid AuthAPIKeyScope", value) +} + +// NewAuthAPIKeyScopeFromValue returns a pointer to a valid AuthAPIKeyScope +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAuthAPIKeyScopeFromValue(v int32) (*AuthAPIKeyScope, error) { + ev := AuthAPIKeyScope(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AuthAPIKeyScope: valid values are %v", v, AllowedAuthAPIKeyScopeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v AuthAPIKeyScope) IsValid() bool { + for _, existing := range AllowedAuthAPIKeyScopeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AuthAPIKeyScope value +func (v AuthAPIKeyScope) Ptr() *AuthAPIKeyScope { + return &v +} + +type NullableAuthAPIKeyScope struct { + value *AuthAPIKeyScope + isSet bool +} + +func (v NullableAuthAPIKeyScope) Get() *AuthAPIKeyScope { + return v.value +} + +func (v *NullableAuthAPIKeyScope) Set(val *AuthAPIKeyScope) { + v.value = val + v.isSet = true +} + +func (v NullableAuthAPIKeyScope) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthAPIKeyScope) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthAPIKeyScope(val *AuthAPIKeyScope) *NullableAuthAPIKeyScope { + return &NullableAuthAPIKeyScope{value: val, isSet: true} +} + +func (v NullableAuthAPIKeyScope) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthAPIKeyScope) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_azure_blob_fs_config.go b/server/common/sftpgo/v2/openapi/model_azure_blob_fs_config.go new file mode 100644 index 00000000..a265872c --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_azure_blob_fs_config.go @@ -0,0 +1,444 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// AzureBlobFsConfig Azure Blob Storage configuration details +type AzureBlobFsConfig struct { + Container *string `json:"container,omitempty"` + // Storage Account Name, leave blank to use SAS URL + AccountName *string `json:"account_name,omitempty"` + AccountKey *Secret `json:"account_key,omitempty"` + SasUrl *Secret `json:"sas_url,omitempty"` + // optional endpoint. Default is \"blob.core.windows.net\". If you use the emulator the endpoint must include the protocol, for example \"http://127.0.0.1:10000\" + Endpoint *string `json:"endpoint,omitempty"` + // the buffer size (in MB) to use for multipart uploads. If this value is set to zero, the default value (4MB) will be used. + UploadPartSize *int32 `json:"upload_part_size,omitempty"` + // the number of parts to upload in parallel. If this value is set to zero, the default value (2) will be used + UploadConcurrency *int32 `json:"upload_concurrency,omitempty"` + AccessTier *string `json:"access_tier,omitempty"` + // key_prefix is similar to a chroot directory for a local filesystem. If specified the user will only see contents that starts with this prefix and so you can restrict access to a specific virtual folder. The prefix, if not empty, must not start with \"/\" and must end with \"/\". If empty the whole container contents will be available + KeyPrefix *string `json:"key_prefix,omitempty"` + UseEmulator *bool `json:"use_emulator,omitempty"` +} + +// NewAzureBlobFsConfig instantiates a new AzureBlobFsConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAzureBlobFsConfig() *AzureBlobFsConfig { + this := AzureBlobFsConfig{} + return &this +} + +// NewAzureBlobFsConfigWithDefaults instantiates a new AzureBlobFsConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAzureBlobFsConfigWithDefaults() *AzureBlobFsConfig { + this := AzureBlobFsConfig{} + return &this +} + +// GetContainer returns the Container field value if set, zero value otherwise. +func (o *AzureBlobFsConfig) GetContainer() string { + if o == nil || o.Container == nil { + var ret string + return ret + } + return *o.Container +} + +// GetContainerOk returns a tuple with the Container field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureBlobFsConfig) GetContainerOk() (*string, bool) { + if o == nil || o.Container == nil { + return nil, false + } + return o.Container, true +} + +// HasContainer returns a boolean if a field has been set. +func (o *AzureBlobFsConfig) HasContainer() bool { + if o != nil && o.Container != nil { + return true + } + + return false +} + +// SetContainer gets a reference to the given string and assigns it to the Container field. +func (o *AzureBlobFsConfig) SetContainer(v string) { + o.Container = &v +} + +// GetAccountName returns the AccountName field value if set, zero value otherwise. +func (o *AzureBlobFsConfig) GetAccountName() string { + if o == nil || o.AccountName == nil { + var ret string + return ret + } + return *o.AccountName +} + +// GetAccountNameOk returns a tuple with the AccountName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureBlobFsConfig) GetAccountNameOk() (*string, bool) { + if o == nil || o.AccountName == nil { + return nil, false + } + return o.AccountName, true +} + +// HasAccountName returns a boolean if a field has been set. +func (o *AzureBlobFsConfig) HasAccountName() bool { + if o != nil && o.AccountName != nil { + return true + } + + return false +} + +// SetAccountName gets a reference to the given string and assigns it to the AccountName field. +func (o *AzureBlobFsConfig) SetAccountName(v string) { + o.AccountName = &v +} + +// GetAccountKey returns the AccountKey field value if set, zero value otherwise. +func (o *AzureBlobFsConfig) GetAccountKey() Secret { + if o == nil || o.AccountKey == nil { + var ret Secret + return ret + } + return *o.AccountKey +} + +// GetAccountKeyOk returns a tuple with the AccountKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureBlobFsConfig) GetAccountKeyOk() (*Secret, bool) { + if o == nil || o.AccountKey == nil { + return nil, false + } + return o.AccountKey, true +} + +// HasAccountKey returns a boolean if a field has been set. +func (o *AzureBlobFsConfig) HasAccountKey() bool { + if o != nil && o.AccountKey != nil { + return true + } + + return false +} + +// SetAccountKey gets a reference to the given Secret and assigns it to the AccountKey field. +func (o *AzureBlobFsConfig) SetAccountKey(v Secret) { + o.AccountKey = &v +} + +// GetSasUrl returns the SasUrl field value if set, zero value otherwise. +func (o *AzureBlobFsConfig) GetSasUrl() Secret { + if o == nil || o.SasUrl == nil { + var ret Secret + return ret + } + return *o.SasUrl +} + +// GetSasUrlOk returns a tuple with the SasUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureBlobFsConfig) GetSasUrlOk() (*Secret, bool) { + if o == nil || o.SasUrl == nil { + return nil, false + } + return o.SasUrl, true +} + +// HasSasUrl returns a boolean if a field has been set. +func (o *AzureBlobFsConfig) HasSasUrl() bool { + if o != nil && o.SasUrl != nil { + return true + } + + return false +} + +// SetSasUrl gets a reference to the given Secret and assigns it to the SasUrl field. +func (o *AzureBlobFsConfig) SetSasUrl(v Secret) { + o.SasUrl = &v +} + +// GetEndpoint returns the Endpoint field value if set, zero value otherwise. +func (o *AzureBlobFsConfig) GetEndpoint() string { + if o == nil || o.Endpoint == nil { + var ret string + return ret + } + return *o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureBlobFsConfig) GetEndpointOk() (*string, bool) { + if o == nil || o.Endpoint == nil { + return nil, false + } + return o.Endpoint, true +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *AzureBlobFsConfig) HasEndpoint() bool { + if o != nil && o.Endpoint != nil { + return true + } + + return false +} + +// SetEndpoint gets a reference to the given string and assigns it to the Endpoint field. +func (o *AzureBlobFsConfig) SetEndpoint(v string) { + o.Endpoint = &v +} + +// GetUploadPartSize returns the UploadPartSize field value if set, zero value otherwise. +func (o *AzureBlobFsConfig) GetUploadPartSize() int32 { + if o == nil || o.UploadPartSize == nil { + var ret int32 + return ret + } + return *o.UploadPartSize +} + +// GetUploadPartSizeOk returns a tuple with the UploadPartSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureBlobFsConfig) GetUploadPartSizeOk() (*int32, bool) { + if o == nil || o.UploadPartSize == nil { + return nil, false + } + return o.UploadPartSize, true +} + +// HasUploadPartSize returns a boolean if a field has been set. +func (o *AzureBlobFsConfig) HasUploadPartSize() bool { + if o != nil && o.UploadPartSize != nil { + return true + } + + return false +} + +// SetUploadPartSize gets a reference to the given int32 and assigns it to the UploadPartSize field. +func (o *AzureBlobFsConfig) SetUploadPartSize(v int32) { + o.UploadPartSize = &v +} + +// GetUploadConcurrency returns the UploadConcurrency field value if set, zero value otherwise. +func (o *AzureBlobFsConfig) GetUploadConcurrency() int32 { + if o == nil || o.UploadConcurrency == nil { + var ret int32 + return ret + } + return *o.UploadConcurrency +} + +// GetUploadConcurrencyOk returns a tuple with the UploadConcurrency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureBlobFsConfig) GetUploadConcurrencyOk() (*int32, bool) { + if o == nil || o.UploadConcurrency == nil { + return nil, false + } + return o.UploadConcurrency, true +} + +// HasUploadConcurrency returns a boolean if a field has been set. +func (o *AzureBlobFsConfig) HasUploadConcurrency() bool { + if o != nil && o.UploadConcurrency != nil { + return true + } + + return false +} + +// SetUploadConcurrency gets a reference to the given int32 and assigns it to the UploadConcurrency field. +func (o *AzureBlobFsConfig) SetUploadConcurrency(v int32) { + o.UploadConcurrency = &v +} + +// GetAccessTier returns the AccessTier field value if set, zero value otherwise. +func (o *AzureBlobFsConfig) GetAccessTier() string { + if o == nil || o.AccessTier == nil { + var ret string + return ret + } + return *o.AccessTier +} + +// GetAccessTierOk returns a tuple with the AccessTier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureBlobFsConfig) GetAccessTierOk() (*string, bool) { + if o == nil || o.AccessTier == nil { + return nil, false + } + return o.AccessTier, true +} + +// HasAccessTier returns a boolean if a field has been set. +func (o *AzureBlobFsConfig) HasAccessTier() bool { + if o != nil && o.AccessTier != nil { + return true + } + + return false +} + +// SetAccessTier gets a reference to the given string and assigns it to the AccessTier field. +func (o *AzureBlobFsConfig) SetAccessTier(v string) { + o.AccessTier = &v +} + +// GetKeyPrefix returns the KeyPrefix field value if set, zero value otherwise. +func (o *AzureBlobFsConfig) GetKeyPrefix() string { + if o == nil || o.KeyPrefix == nil { + var ret string + return ret + } + return *o.KeyPrefix +} + +// GetKeyPrefixOk returns a tuple with the KeyPrefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureBlobFsConfig) GetKeyPrefixOk() (*string, bool) { + if o == nil || o.KeyPrefix == nil { + return nil, false + } + return o.KeyPrefix, true +} + +// HasKeyPrefix returns a boolean if a field has been set. +func (o *AzureBlobFsConfig) HasKeyPrefix() bool { + if o != nil && o.KeyPrefix != nil { + return true + } + + return false +} + +// SetKeyPrefix gets a reference to the given string and assigns it to the KeyPrefix field. +func (o *AzureBlobFsConfig) SetKeyPrefix(v string) { + o.KeyPrefix = &v +} + +// GetUseEmulator returns the UseEmulator field value if set, zero value otherwise. +func (o *AzureBlobFsConfig) GetUseEmulator() bool { + if o == nil || o.UseEmulator == nil { + var ret bool + return ret + } + return *o.UseEmulator +} + +// GetUseEmulatorOk returns a tuple with the UseEmulator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureBlobFsConfig) GetUseEmulatorOk() (*bool, bool) { + if o == nil || o.UseEmulator == nil { + return nil, false + } + return o.UseEmulator, true +} + +// HasUseEmulator returns a boolean if a field has been set. +func (o *AzureBlobFsConfig) HasUseEmulator() bool { + if o != nil && o.UseEmulator != nil { + return true + } + + return false +} + +// SetUseEmulator gets a reference to the given bool and assigns it to the UseEmulator field. +func (o *AzureBlobFsConfig) SetUseEmulator(v bool) { + o.UseEmulator = &v +} + +func (o AzureBlobFsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Container != nil { + toSerialize["container"] = o.Container + } + if o.AccountName != nil { + toSerialize["account_name"] = o.AccountName + } + if o.AccountKey != nil { + toSerialize["account_key"] = o.AccountKey + } + if o.SasUrl != nil { + toSerialize["sas_url"] = o.SasUrl + } + if o.Endpoint != nil { + toSerialize["endpoint"] = o.Endpoint + } + if o.UploadPartSize != nil { + toSerialize["upload_part_size"] = o.UploadPartSize + } + if o.UploadConcurrency != nil { + toSerialize["upload_concurrency"] = o.UploadConcurrency + } + if o.AccessTier != nil { + toSerialize["access_tier"] = o.AccessTier + } + if o.KeyPrefix != nil { + toSerialize["key_prefix"] = o.KeyPrefix + } + if o.UseEmulator != nil { + toSerialize["use_emulator"] = o.UseEmulator + } + return json.Marshal(toSerialize) +} + +type NullableAzureBlobFsConfig struct { + value *AzureBlobFsConfig + isSet bool +} + +func (v NullableAzureBlobFsConfig) Get() *AzureBlobFsConfig { + return v.value +} + +func (v *NullableAzureBlobFsConfig) Set(val *AzureBlobFsConfig) { + v.value = val + v.isSet = true +} + +func (v NullableAzureBlobFsConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableAzureBlobFsConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAzureBlobFsConfig(val *AzureBlobFsConfig) *NullableAzureBlobFsConfig { + return &NullableAzureBlobFsConfig{value: val, isSet: true} +} + +func (v NullableAzureBlobFsConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAzureBlobFsConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_backup_data.go b/server/common/sftpgo/v2/openapi/model_backup_data.go new file mode 100644 index 00000000..22f2d253 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_backup_data.go @@ -0,0 +1,295 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// BackupData struct for BackupData +type BackupData struct { + Users []User `json:"users,omitempty"` + Folders []BaseVirtualFolder `json:"folders,omitempty"` + Admins []Admin `json:"admins,omitempty"` + ApiKeys []AuthAPIKey `json:"api_keys,omitempty"` + Shares []Share `json:"shares,omitempty"` + Version *int32 `json:"version,omitempty"` +} + +// NewBackupData instantiates a new BackupData object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBackupData() *BackupData { + this := BackupData{} + return &this +} + +// NewBackupDataWithDefaults instantiates a new BackupData object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBackupDataWithDefaults() *BackupData { + this := BackupData{} + return &this +} + +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *BackupData) GetUsers() []User { + if o == nil || o.Users == nil { + var ret []User + return ret + } + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupData) GetUsersOk() ([]User, bool) { + if o == nil || o.Users == nil { + return nil, false + } + return o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *BackupData) HasUsers() bool { + if o != nil && o.Users != nil { + return true + } + + return false +} + +// SetUsers gets a reference to the given []User and assigns it to the Users field. +func (o *BackupData) SetUsers(v []User) { + o.Users = v +} + +// GetFolders returns the Folders field value if set, zero value otherwise. +func (o *BackupData) GetFolders() []BaseVirtualFolder { + if o == nil || o.Folders == nil { + var ret []BaseVirtualFolder + return ret + } + return o.Folders +} + +// GetFoldersOk returns a tuple with the Folders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupData) GetFoldersOk() ([]BaseVirtualFolder, bool) { + if o == nil || o.Folders == nil { + return nil, false + } + return o.Folders, true +} + +// HasFolders returns a boolean if a field has been set. +func (o *BackupData) HasFolders() bool { + if o != nil && o.Folders != nil { + return true + } + + return false +} + +// SetFolders gets a reference to the given []BaseVirtualFolder and assigns it to the Folders field. +func (o *BackupData) SetFolders(v []BaseVirtualFolder) { + o.Folders = v +} + +// GetAdmins returns the Admins field value if set, zero value otherwise. +func (o *BackupData) GetAdmins() []Admin { + if o == nil || o.Admins == nil { + var ret []Admin + return ret + } + return o.Admins +} + +// GetAdminsOk returns a tuple with the Admins field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupData) GetAdminsOk() ([]Admin, bool) { + if o == nil || o.Admins == nil { + return nil, false + } + return o.Admins, true +} + +// HasAdmins returns a boolean if a field has been set. +func (o *BackupData) HasAdmins() bool { + if o != nil && o.Admins != nil { + return true + } + + return false +} + +// SetAdmins gets a reference to the given []Admin and assigns it to the Admins field. +func (o *BackupData) SetAdmins(v []Admin) { + o.Admins = v +} + +// GetApiKeys returns the ApiKeys field value if set, zero value otherwise. +func (o *BackupData) GetApiKeys() []AuthAPIKey { + if o == nil || o.ApiKeys == nil { + var ret []AuthAPIKey + return ret + } + return o.ApiKeys +} + +// GetApiKeysOk returns a tuple with the ApiKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupData) GetApiKeysOk() ([]AuthAPIKey, bool) { + if o == nil || o.ApiKeys == nil { + return nil, false + } + return o.ApiKeys, true +} + +// HasApiKeys returns a boolean if a field has been set. +func (o *BackupData) HasApiKeys() bool { + if o != nil && o.ApiKeys != nil { + return true + } + + return false +} + +// SetApiKeys gets a reference to the given []AuthAPIKey and assigns it to the ApiKeys field. +func (o *BackupData) SetApiKeys(v []AuthAPIKey) { + o.ApiKeys = v +} + +// GetShares returns the Shares field value if set, zero value otherwise. +func (o *BackupData) GetShares() []Share { + if o == nil || o.Shares == nil { + var ret []Share + return ret + } + return o.Shares +} + +// GetSharesOk returns a tuple with the Shares field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupData) GetSharesOk() ([]Share, bool) { + if o == nil || o.Shares == nil { + return nil, false + } + return o.Shares, true +} + +// HasShares returns a boolean if a field has been set. +func (o *BackupData) HasShares() bool { + if o != nil && o.Shares != nil { + return true + } + + return false +} + +// SetShares gets a reference to the given []Share and assigns it to the Shares field. +func (o *BackupData) SetShares(v []Share) { + o.Shares = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *BackupData) GetVersion() int32 { + if o == nil || o.Version == nil { + var ret int32 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupData) GetVersionOk() (*int32, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *BackupData) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int32 and assigns it to the Version field. +func (o *BackupData) SetVersion(v int32) { + o.Version = &v +} + +func (o BackupData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Users != nil { + toSerialize["users"] = o.Users + } + if o.Folders != nil { + toSerialize["folders"] = o.Folders + } + if o.Admins != nil { + toSerialize["admins"] = o.Admins + } + if o.ApiKeys != nil { + toSerialize["api_keys"] = o.ApiKeys + } + if o.Shares != nil { + toSerialize["shares"] = o.Shares + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + return json.Marshal(toSerialize) +} + +type NullableBackupData struct { + value *BackupData + isSet bool +} + +func (v NullableBackupData) Get() *BackupData { + return v.value +} + +func (v *NullableBackupData) Set(val *BackupData) { + v.value = val + v.isSet = true +} + +func (v NullableBackupData) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupData(val *BackupData) *NullableBackupData { + return &NullableBackupData{value: val, isSet: true} +} + +func (v NullableBackupData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_ban_status.go b/server/common/sftpgo/v2/openapi/model_ban_status.go new file mode 100644 index 00000000..6db745e9 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_ban_status.go @@ -0,0 +1,127 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// BanStatus struct for BanStatus +type BanStatus struct { + // if null the host is not banned + DateTime NullableTime `json:"date_time,omitempty"` +} + +// NewBanStatus instantiates a new BanStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBanStatus() *BanStatus { + this := BanStatus{} + return &this +} + +// NewBanStatusWithDefaults instantiates a new BanStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBanStatusWithDefaults() *BanStatus { + this := BanStatus{} + return &this +} + +// GetDateTime returns the DateTime field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *BanStatus) GetDateTime() time.Time { + if o == nil || o.DateTime.Get() == nil { + var ret time.Time + return ret + } + return *o.DateTime.Get() +} + +// GetDateTimeOk returns a tuple with the DateTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BanStatus) GetDateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.DateTime.Get(), o.DateTime.IsSet() +} + +// HasDateTime returns a boolean if a field has been set. +func (o *BanStatus) HasDateTime() bool { + if o != nil && o.DateTime.IsSet() { + return true + } + + return false +} + +// SetDateTime gets a reference to the given NullableTime and assigns it to the DateTime field. +func (o *BanStatus) SetDateTime(v time.Time) { + o.DateTime.Set(&v) +} +// SetDateTimeNil sets the value for DateTime to be an explicit nil +func (o *BanStatus) SetDateTimeNil() { + o.DateTime.Set(nil) +} + +// UnsetDateTime ensures that no value is present for DateTime, not even an explicit nil +func (o *BanStatus) UnsetDateTime() { + o.DateTime.Unset() +} + +func (o BanStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.DateTime.IsSet() { + toSerialize["date_time"] = o.DateTime.Get() + } + return json.Marshal(toSerialize) +} + +type NullableBanStatus struct { + value *BanStatus + isSet bool +} + +func (v NullableBanStatus) Get() *BanStatus { + return v.value +} + +func (v *NullableBanStatus) Set(val *BanStatus) { + v.value = val + v.isSet = true +} + +func (v NullableBanStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableBanStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBanStatus(val *BanStatus) *NullableBanStatus { + return &NullableBanStatus{value: val, isSet: true} +} + +func (v NullableBanStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBanStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_bandwidth_limit.go b/server/common/sftpgo/v2/openapi/model_bandwidth_limit.go new file mode 100644 index 00000000..8371a3ed --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_bandwidth_limit.go @@ -0,0 +1,190 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// BandwidthLimit struct for BandwidthLimit +type BandwidthLimit struct { + // Source networks in CIDR notation as defined in RFC 4632 and RFC 4291 for example `192.0.2.0/24` or `2001:db8::/32`. The limit applies if the defined networks contain the client IP + Sources []string `json:"sources,omitempty"` + // Maximum upload bandwidth as KB/s, 0 means unlimited + UploadBandwidth *int32 `json:"upload_bandwidth,omitempty"` + // Maximum download bandwidth as KB/s, 0 means unlimited + DownloadBandwidth *int32 `json:"download_bandwidth,omitempty"` +} + +// NewBandwidthLimit instantiates a new BandwidthLimit object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBandwidthLimit() *BandwidthLimit { + this := BandwidthLimit{} + return &this +} + +// NewBandwidthLimitWithDefaults instantiates a new BandwidthLimit object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBandwidthLimitWithDefaults() *BandwidthLimit { + this := BandwidthLimit{} + return &this +} + +// GetSources returns the Sources field value if set, zero value otherwise. +func (o *BandwidthLimit) GetSources() []string { + if o == nil || o.Sources == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BandwidthLimit) GetSourcesOk() ([]string, bool) { + if o == nil || o.Sources == nil { + return nil, false + } + return o.Sources, true +} + +// HasSources returns a boolean if a field has been set. +func (o *BandwidthLimit) HasSources() bool { + if o != nil && o.Sources != nil { + return true + } + + return false +} + +// SetSources gets a reference to the given []string and assigns it to the Sources field. +func (o *BandwidthLimit) SetSources(v []string) { + o.Sources = v +} + +// GetUploadBandwidth returns the UploadBandwidth field value if set, zero value otherwise. +func (o *BandwidthLimit) GetUploadBandwidth() int32 { + if o == nil || o.UploadBandwidth == nil { + var ret int32 + return ret + } + return *o.UploadBandwidth +} + +// GetUploadBandwidthOk returns a tuple with the UploadBandwidth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BandwidthLimit) GetUploadBandwidthOk() (*int32, bool) { + if o == nil || o.UploadBandwidth == nil { + return nil, false + } + return o.UploadBandwidth, true +} + +// HasUploadBandwidth returns a boolean if a field has been set. +func (o *BandwidthLimit) HasUploadBandwidth() bool { + if o != nil && o.UploadBandwidth != nil { + return true + } + + return false +} + +// SetUploadBandwidth gets a reference to the given int32 and assigns it to the UploadBandwidth field. +func (o *BandwidthLimit) SetUploadBandwidth(v int32) { + o.UploadBandwidth = &v +} + +// GetDownloadBandwidth returns the DownloadBandwidth field value if set, zero value otherwise. +func (o *BandwidthLimit) GetDownloadBandwidth() int32 { + if o == nil || o.DownloadBandwidth == nil { + var ret int32 + return ret + } + return *o.DownloadBandwidth +} + +// GetDownloadBandwidthOk returns a tuple with the DownloadBandwidth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BandwidthLimit) GetDownloadBandwidthOk() (*int32, bool) { + if o == nil || o.DownloadBandwidth == nil { + return nil, false + } + return o.DownloadBandwidth, true +} + +// HasDownloadBandwidth returns a boolean if a field has been set. +func (o *BandwidthLimit) HasDownloadBandwidth() bool { + if o != nil && o.DownloadBandwidth != nil { + return true + } + + return false +} + +// SetDownloadBandwidth gets a reference to the given int32 and assigns it to the DownloadBandwidth field. +func (o *BandwidthLimit) SetDownloadBandwidth(v int32) { + o.DownloadBandwidth = &v +} + +func (o BandwidthLimit) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Sources != nil { + toSerialize["sources"] = o.Sources + } + if o.UploadBandwidth != nil { + toSerialize["upload_bandwidth"] = o.UploadBandwidth + } + if o.DownloadBandwidth != nil { + toSerialize["download_bandwidth"] = o.DownloadBandwidth + } + return json.Marshal(toSerialize) +} + +type NullableBandwidthLimit struct { + value *BandwidthLimit + isSet bool +} + +func (v NullableBandwidthLimit) Get() *BandwidthLimit { + return v.value +} + +func (v *NullableBandwidthLimit) Set(val *BandwidthLimit) { + v.value = val + v.isSet = true +} + +func (v NullableBandwidthLimit) IsSet() bool { + return v.isSet +} + +func (v *NullableBandwidthLimit) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBandwidthLimit(val *BandwidthLimit) *NullableBandwidthLimit { + return &NullableBandwidthLimit{value: val, isSet: true} +} + +func (v NullableBandwidthLimit) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBandwidthLimit) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_base_totp_config.go b/server/common/sftpgo/v2/openapi/model_base_totp_config.go new file mode 100644 index 00000000..548d7cd4 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_base_totp_config.go @@ -0,0 +1,188 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// BaseTOTPConfig struct for BaseTOTPConfig +type BaseTOTPConfig struct { + Enabled *bool `json:"enabled,omitempty"` + // This name must be defined within the \"totp\" section of the SFTPGo configuration file. You will be unable to save a user/admin referencing a missing config_name + ConfigName *string `json:"config_name,omitempty"` + Secret *Secret `json:"secret,omitempty"` +} + +// NewBaseTOTPConfig instantiates a new BaseTOTPConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseTOTPConfig() *BaseTOTPConfig { + this := BaseTOTPConfig{} + return &this +} + +// NewBaseTOTPConfigWithDefaults instantiates a new BaseTOTPConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseTOTPConfigWithDefaults() *BaseTOTPConfig { + this := BaseTOTPConfig{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *BaseTOTPConfig) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseTOTPConfig) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *BaseTOTPConfig) HasEnabled() bool { + if o != nil && o.Enabled != nil { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *BaseTOTPConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetConfigName returns the ConfigName field value if set, zero value otherwise. +func (o *BaseTOTPConfig) GetConfigName() string { + if o == nil || o.ConfigName == nil { + var ret string + return ret + } + return *o.ConfigName +} + +// GetConfigNameOk returns a tuple with the ConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseTOTPConfig) GetConfigNameOk() (*string, bool) { + if o == nil || o.ConfigName == nil { + return nil, false + } + return o.ConfigName, true +} + +// HasConfigName returns a boolean if a field has been set. +func (o *BaseTOTPConfig) HasConfigName() bool { + if o != nil && o.ConfigName != nil { + return true + } + + return false +} + +// SetConfigName gets a reference to the given string and assigns it to the ConfigName field. +func (o *BaseTOTPConfig) SetConfigName(v string) { + o.ConfigName = &v +} + +// GetSecret returns the Secret field value if set, zero value otherwise. +func (o *BaseTOTPConfig) GetSecret() Secret { + if o == nil || o.Secret == nil { + var ret Secret + return ret + } + return *o.Secret +} + +// GetSecretOk returns a tuple with the Secret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseTOTPConfig) GetSecretOk() (*Secret, bool) { + if o == nil || o.Secret == nil { + return nil, false + } + return o.Secret, true +} + +// HasSecret returns a boolean if a field has been set. +func (o *BaseTOTPConfig) HasSecret() bool { + if o != nil && o.Secret != nil { + return true + } + + return false +} + +// SetSecret gets a reference to the given Secret and assigns it to the Secret field. +func (o *BaseTOTPConfig) SetSecret(v Secret) { + o.Secret = &v +} + +func (o BaseTOTPConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.ConfigName != nil { + toSerialize["config_name"] = o.ConfigName + } + if o.Secret != nil { + toSerialize["secret"] = o.Secret + } + return json.Marshal(toSerialize) +} + +type NullableBaseTOTPConfig struct { + value *BaseTOTPConfig + isSet bool +} + +func (v NullableBaseTOTPConfig) Get() *BaseTOTPConfig { + return v.value +} + +func (v *NullableBaseTOTPConfig) Set(val *BaseTOTPConfig) { + v.value = val + v.isSet = true +} + +func (v NullableBaseTOTPConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseTOTPConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseTOTPConfig(val *BaseTOTPConfig) *NullableBaseTOTPConfig { + return &NullableBaseTOTPConfig{value: val, isSet: true} +} + +func (v NullableBaseTOTPConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseTOTPConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_base_virtual_folder.go b/server/common/sftpgo/v2/openapi/model_base_virtual_folder.go new file mode 100644 index 00000000..a5d374f5 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_base_virtual_folder.go @@ -0,0 +1,408 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// BaseVirtualFolder Defines the filesystem for the virtual folder and the used quota limits. The same folder can be shared among multiple users and each user can have different quota limits or a different virtual path. +type BaseVirtualFolder struct { + Id *int32 `json:"id,omitempty"` + // unique name for this virtual folder + Name *string `json:"name,omitempty"` + // absolute filesystem path to use as virtual folder + MappedPath *string `json:"mapped_path,omitempty"` + // optional description + Description *string `json:"description,omitempty"` + UsedQuotaSize *int64 `json:"used_quota_size,omitempty"` + UsedQuotaFiles *int32 `json:"used_quota_files,omitempty"` + // Last quota update as unix timestamp in milliseconds + LastQuotaUpdate *int64 `json:"last_quota_update,omitempty"` + // list of usernames associated with this virtual folder + Users []string `json:"users,omitempty"` + Filesystem *FilesystemConfig `json:"filesystem,omitempty"` +} + +// NewBaseVirtualFolder instantiates a new BaseVirtualFolder object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseVirtualFolder() *BaseVirtualFolder { + this := BaseVirtualFolder{} + return &this +} + +// NewBaseVirtualFolderWithDefaults instantiates a new BaseVirtualFolder object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseVirtualFolderWithDefaults() *BaseVirtualFolder { + this := BaseVirtualFolder{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BaseVirtualFolder) GetId() int32 { + if o == nil || o.Id == nil { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseVirtualFolder) GetIdOk() (*int32, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BaseVirtualFolder) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *BaseVirtualFolder) SetId(v int32) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *BaseVirtualFolder) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseVirtualFolder) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *BaseVirtualFolder) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *BaseVirtualFolder) SetName(v string) { + o.Name = &v +} + +// GetMappedPath returns the MappedPath field value if set, zero value otherwise. +func (o *BaseVirtualFolder) GetMappedPath() string { + if o == nil || o.MappedPath == nil { + var ret string + return ret + } + return *o.MappedPath +} + +// GetMappedPathOk returns a tuple with the MappedPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseVirtualFolder) GetMappedPathOk() (*string, bool) { + if o == nil || o.MappedPath == nil { + return nil, false + } + return o.MappedPath, true +} + +// HasMappedPath returns a boolean if a field has been set. +func (o *BaseVirtualFolder) HasMappedPath() bool { + if o != nil && o.MappedPath != nil { + return true + } + + return false +} + +// SetMappedPath gets a reference to the given string and assigns it to the MappedPath field. +func (o *BaseVirtualFolder) SetMappedPath(v string) { + o.MappedPath = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *BaseVirtualFolder) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseVirtualFolder) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *BaseVirtualFolder) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *BaseVirtualFolder) SetDescription(v string) { + o.Description = &v +} + +// GetUsedQuotaSize returns the UsedQuotaSize field value if set, zero value otherwise. +func (o *BaseVirtualFolder) GetUsedQuotaSize() int64 { + if o == nil || o.UsedQuotaSize == nil { + var ret int64 + return ret + } + return *o.UsedQuotaSize +} + +// GetUsedQuotaSizeOk returns a tuple with the UsedQuotaSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseVirtualFolder) GetUsedQuotaSizeOk() (*int64, bool) { + if o == nil || o.UsedQuotaSize == nil { + return nil, false + } + return o.UsedQuotaSize, true +} + +// HasUsedQuotaSize returns a boolean if a field has been set. +func (o *BaseVirtualFolder) HasUsedQuotaSize() bool { + if o != nil && o.UsedQuotaSize != nil { + return true + } + + return false +} + +// SetUsedQuotaSize gets a reference to the given int64 and assigns it to the UsedQuotaSize field. +func (o *BaseVirtualFolder) SetUsedQuotaSize(v int64) { + o.UsedQuotaSize = &v +} + +// GetUsedQuotaFiles returns the UsedQuotaFiles field value if set, zero value otherwise. +func (o *BaseVirtualFolder) GetUsedQuotaFiles() int32 { + if o == nil || o.UsedQuotaFiles == nil { + var ret int32 + return ret + } + return *o.UsedQuotaFiles +} + +// GetUsedQuotaFilesOk returns a tuple with the UsedQuotaFiles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseVirtualFolder) GetUsedQuotaFilesOk() (*int32, bool) { + if o == nil || o.UsedQuotaFiles == nil { + return nil, false + } + return o.UsedQuotaFiles, true +} + +// HasUsedQuotaFiles returns a boolean if a field has been set. +func (o *BaseVirtualFolder) HasUsedQuotaFiles() bool { + if o != nil && o.UsedQuotaFiles != nil { + return true + } + + return false +} + +// SetUsedQuotaFiles gets a reference to the given int32 and assigns it to the UsedQuotaFiles field. +func (o *BaseVirtualFolder) SetUsedQuotaFiles(v int32) { + o.UsedQuotaFiles = &v +} + +// GetLastQuotaUpdate returns the LastQuotaUpdate field value if set, zero value otherwise. +func (o *BaseVirtualFolder) GetLastQuotaUpdate() int64 { + if o == nil || o.LastQuotaUpdate == nil { + var ret int64 + return ret + } + return *o.LastQuotaUpdate +} + +// GetLastQuotaUpdateOk returns a tuple with the LastQuotaUpdate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseVirtualFolder) GetLastQuotaUpdateOk() (*int64, bool) { + if o == nil || o.LastQuotaUpdate == nil { + return nil, false + } + return o.LastQuotaUpdate, true +} + +// HasLastQuotaUpdate returns a boolean if a field has been set. +func (o *BaseVirtualFolder) HasLastQuotaUpdate() bool { + if o != nil && o.LastQuotaUpdate != nil { + return true + } + + return false +} + +// SetLastQuotaUpdate gets a reference to the given int64 and assigns it to the LastQuotaUpdate field. +func (o *BaseVirtualFolder) SetLastQuotaUpdate(v int64) { + o.LastQuotaUpdate = &v +} + +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *BaseVirtualFolder) GetUsers() []string { + if o == nil || o.Users == nil { + var ret []string + return ret + } + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseVirtualFolder) GetUsersOk() ([]string, bool) { + if o == nil || o.Users == nil { + return nil, false + } + return o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *BaseVirtualFolder) HasUsers() bool { + if o != nil && o.Users != nil { + return true + } + + return false +} + +// SetUsers gets a reference to the given []string and assigns it to the Users field. +func (o *BaseVirtualFolder) SetUsers(v []string) { + o.Users = v +} + +// GetFilesystem returns the Filesystem field value if set, zero value otherwise. +func (o *BaseVirtualFolder) GetFilesystem() FilesystemConfig { + if o == nil || o.Filesystem == nil { + var ret FilesystemConfig + return ret + } + return *o.Filesystem +} + +// GetFilesystemOk returns a tuple with the Filesystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseVirtualFolder) GetFilesystemOk() (*FilesystemConfig, bool) { + if o == nil || o.Filesystem == nil { + return nil, false + } + return o.Filesystem, true +} + +// HasFilesystem returns a boolean if a field has been set. +func (o *BaseVirtualFolder) HasFilesystem() bool { + if o != nil && o.Filesystem != nil { + return true + } + + return false +} + +// SetFilesystem gets a reference to the given FilesystemConfig and assigns it to the Filesystem field. +func (o *BaseVirtualFolder) SetFilesystem(v FilesystemConfig) { + o.Filesystem = &v +} + +func (o BaseVirtualFolder) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.MappedPath != nil { + toSerialize["mapped_path"] = o.MappedPath + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.UsedQuotaSize != nil { + toSerialize["used_quota_size"] = o.UsedQuotaSize + } + if o.UsedQuotaFiles != nil { + toSerialize["used_quota_files"] = o.UsedQuotaFiles + } + if o.LastQuotaUpdate != nil { + toSerialize["last_quota_update"] = o.LastQuotaUpdate + } + if o.Users != nil { + toSerialize["users"] = o.Users + } + if o.Filesystem != nil { + toSerialize["filesystem"] = o.Filesystem + } + return json.Marshal(toSerialize) +} + +type NullableBaseVirtualFolder struct { + value *BaseVirtualFolder + isSet bool +} + +func (v NullableBaseVirtualFolder) Get() *BaseVirtualFolder { + return v.value +} + +func (v *NullableBaseVirtualFolder) Set(val *BaseVirtualFolder) { + v.value = val + v.isSet = true +} + +func (v NullableBaseVirtualFolder) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseVirtualFolder) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseVirtualFolder(val *BaseVirtualFolder) *NullableBaseVirtualFolder { + return &NullableBaseVirtualFolder{value: val, isSet: true} +} + +func (v NullableBaseVirtualFolder) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseVirtualFolder) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_connection_status.go b/server/common/sftpgo/v2/openapi/model_connection_status.go new file mode 100644 index 00000000..f9e2c6bf --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_connection_status.go @@ -0,0 +1,410 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// ConnectionStatus struct for ConnectionStatus +type ConnectionStatus struct { + // connected username + Username *string `json:"username,omitempty"` + // unique connection identifier + ConnectionId *string `json:"connection_id,omitempty"` + // client version + ClientVersion *string `json:"client_version,omitempty"` + // Remote address for the connected client + RemoteAddress *string `json:"remote_address,omitempty"` + // connection time as unix timestamp in milliseconds + ConnectionTime *int64 `json:"connection_time,omitempty"` + // Last SSH/FTP command or WebDAV method + Command *string `json:"command,omitempty"` + // last client activity as unix timestamp in milliseconds + LastActivity *int64 `json:"last_activity,omitempty"` + Protocol *string `json:"protocol,omitempty"` + ActiveTransfers []Transfer `json:"active_transfers,omitempty"` +} + +// NewConnectionStatus instantiates a new ConnectionStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewConnectionStatus() *ConnectionStatus { + this := ConnectionStatus{} + return &this +} + +// NewConnectionStatusWithDefaults instantiates a new ConnectionStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewConnectionStatusWithDefaults() *ConnectionStatus { + this := ConnectionStatus{} + return &this +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *ConnectionStatus) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatus) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *ConnectionStatus) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *ConnectionStatus) SetUsername(v string) { + o.Username = &v +} + +// GetConnectionId returns the ConnectionId field value if set, zero value otherwise. +func (o *ConnectionStatus) GetConnectionId() string { + if o == nil || o.ConnectionId == nil { + var ret string + return ret + } + return *o.ConnectionId +} + +// GetConnectionIdOk returns a tuple with the ConnectionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatus) GetConnectionIdOk() (*string, bool) { + if o == nil || o.ConnectionId == nil { + return nil, false + } + return o.ConnectionId, true +} + +// HasConnectionId returns a boolean if a field has been set. +func (o *ConnectionStatus) HasConnectionId() bool { + if o != nil && o.ConnectionId != nil { + return true + } + + return false +} + +// SetConnectionId gets a reference to the given string and assigns it to the ConnectionId field. +func (o *ConnectionStatus) SetConnectionId(v string) { + o.ConnectionId = &v +} + +// GetClientVersion returns the ClientVersion field value if set, zero value otherwise. +func (o *ConnectionStatus) GetClientVersion() string { + if o == nil || o.ClientVersion == nil { + var ret string + return ret + } + return *o.ClientVersion +} + +// GetClientVersionOk returns a tuple with the ClientVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatus) GetClientVersionOk() (*string, bool) { + if o == nil || o.ClientVersion == nil { + return nil, false + } + return o.ClientVersion, true +} + +// HasClientVersion returns a boolean if a field has been set. +func (o *ConnectionStatus) HasClientVersion() bool { + if o != nil && o.ClientVersion != nil { + return true + } + + return false +} + +// SetClientVersion gets a reference to the given string and assigns it to the ClientVersion field. +func (o *ConnectionStatus) SetClientVersion(v string) { + o.ClientVersion = &v +} + +// GetRemoteAddress returns the RemoteAddress field value if set, zero value otherwise. +func (o *ConnectionStatus) GetRemoteAddress() string { + if o == nil || o.RemoteAddress == nil { + var ret string + return ret + } + return *o.RemoteAddress +} + +// GetRemoteAddressOk returns a tuple with the RemoteAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatus) GetRemoteAddressOk() (*string, bool) { + if o == nil || o.RemoteAddress == nil { + return nil, false + } + return o.RemoteAddress, true +} + +// HasRemoteAddress returns a boolean if a field has been set. +func (o *ConnectionStatus) HasRemoteAddress() bool { + if o != nil && o.RemoteAddress != nil { + return true + } + + return false +} + +// SetRemoteAddress gets a reference to the given string and assigns it to the RemoteAddress field. +func (o *ConnectionStatus) SetRemoteAddress(v string) { + o.RemoteAddress = &v +} + +// GetConnectionTime returns the ConnectionTime field value if set, zero value otherwise. +func (o *ConnectionStatus) GetConnectionTime() int64 { + if o == nil || o.ConnectionTime == nil { + var ret int64 + return ret + } + return *o.ConnectionTime +} + +// GetConnectionTimeOk returns a tuple with the ConnectionTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatus) GetConnectionTimeOk() (*int64, bool) { + if o == nil || o.ConnectionTime == nil { + return nil, false + } + return o.ConnectionTime, true +} + +// HasConnectionTime returns a boolean if a field has been set. +func (o *ConnectionStatus) HasConnectionTime() bool { + if o != nil && o.ConnectionTime != nil { + return true + } + + return false +} + +// SetConnectionTime gets a reference to the given int64 and assigns it to the ConnectionTime field. +func (o *ConnectionStatus) SetConnectionTime(v int64) { + o.ConnectionTime = &v +} + +// GetCommand returns the Command field value if set, zero value otherwise. +func (o *ConnectionStatus) GetCommand() string { + if o == nil || o.Command == nil { + var ret string + return ret + } + return *o.Command +} + +// GetCommandOk returns a tuple with the Command field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatus) GetCommandOk() (*string, bool) { + if o == nil || o.Command == nil { + return nil, false + } + return o.Command, true +} + +// HasCommand returns a boolean if a field has been set. +func (o *ConnectionStatus) HasCommand() bool { + if o != nil && o.Command != nil { + return true + } + + return false +} + +// SetCommand gets a reference to the given string and assigns it to the Command field. +func (o *ConnectionStatus) SetCommand(v string) { + o.Command = &v +} + +// GetLastActivity returns the LastActivity field value if set, zero value otherwise. +func (o *ConnectionStatus) GetLastActivity() int64 { + if o == nil || o.LastActivity == nil { + var ret int64 + return ret + } + return *o.LastActivity +} + +// GetLastActivityOk returns a tuple with the LastActivity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatus) GetLastActivityOk() (*int64, bool) { + if o == nil || o.LastActivity == nil { + return nil, false + } + return o.LastActivity, true +} + +// HasLastActivity returns a boolean if a field has been set. +func (o *ConnectionStatus) HasLastActivity() bool { + if o != nil && o.LastActivity != nil { + return true + } + + return false +} + +// SetLastActivity gets a reference to the given int64 and assigns it to the LastActivity field. +func (o *ConnectionStatus) SetLastActivity(v int64) { + o.LastActivity = &v +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *ConnectionStatus) GetProtocol() string { + if o == nil || o.Protocol == nil { + var ret string + return ret + } + return *o.Protocol +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatus) GetProtocolOk() (*string, bool) { + if o == nil || o.Protocol == nil { + return nil, false + } + return o.Protocol, true +} + +// HasProtocol returns a boolean if a field has been set. +func (o *ConnectionStatus) HasProtocol() bool { + if o != nil && o.Protocol != nil { + return true + } + + return false +} + +// SetProtocol gets a reference to the given string and assigns it to the Protocol field. +func (o *ConnectionStatus) SetProtocol(v string) { + o.Protocol = &v +} + +// GetActiveTransfers returns the ActiveTransfers field value if set, zero value otherwise. +func (o *ConnectionStatus) GetActiveTransfers() []Transfer { + if o == nil || o.ActiveTransfers == nil { + var ret []Transfer + return ret + } + return o.ActiveTransfers +} + +// GetActiveTransfersOk returns a tuple with the ActiveTransfers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatus) GetActiveTransfersOk() ([]Transfer, bool) { + if o == nil || o.ActiveTransfers == nil { + return nil, false + } + return o.ActiveTransfers, true +} + +// HasActiveTransfers returns a boolean if a field has been set. +func (o *ConnectionStatus) HasActiveTransfers() bool { + if o != nil && o.ActiveTransfers != nil { + return true + } + + return false +} + +// SetActiveTransfers gets a reference to the given []Transfer and assigns it to the ActiveTransfers field. +func (o *ConnectionStatus) SetActiveTransfers(v []Transfer) { + o.ActiveTransfers = v +} + +func (o ConnectionStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.ConnectionId != nil { + toSerialize["connection_id"] = o.ConnectionId + } + if o.ClientVersion != nil { + toSerialize["client_version"] = o.ClientVersion + } + if o.RemoteAddress != nil { + toSerialize["remote_address"] = o.RemoteAddress + } + if o.ConnectionTime != nil { + toSerialize["connection_time"] = o.ConnectionTime + } + if o.Command != nil { + toSerialize["command"] = o.Command + } + if o.LastActivity != nil { + toSerialize["last_activity"] = o.LastActivity + } + if o.Protocol != nil { + toSerialize["protocol"] = o.Protocol + } + if o.ActiveTransfers != nil { + toSerialize["active_transfers"] = o.ActiveTransfers + } + return json.Marshal(toSerialize) +} + +type NullableConnectionStatus struct { + value *ConnectionStatus + isSet bool +} + +func (v NullableConnectionStatus) Get() *ConnectionStatus { + return v.value +} + +func (v *NullableConnectionStatus) Set(val *ConnectionStatus) { + v.value = val + v.isSet = true +} + +func (v NullableConnectionStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectionStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectionStatus(val *ConnectionStatus) *NullableConnectionStatus { + return &NullableConnectionStatus{value: val, isSet: true} +} + +func (v NullableConnectionStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectionStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_crypt_fs_config.go b/server/common/sftpgo/v2/openapi/model_crypt_fs_config.go new file mode 100644 index 00000000..a6a696a5 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_crypt_fs_config.go @@ -0,0 +1,115 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// CryptFsConfig Crypt filesystem configuration details +type CryptFsConfig struct { + Passphrase *Secret `json:"passphrase,omitempty"` +} + +// NewCryptFsConfig instantiates a new CryptFsConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCryptFsConfig() *CryptFsConfig { + this := CryptFsConfig{} + return &this +} + +// NewCryptFsConfigWithDefaults instantiates a new CryptFsConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCryptFsConfigWithDefaults() *CryptFsConfig { + this := CryptFsConfig{} + return &this +} + +// GetPassphrase returns the Passphrase field value if set, zero value otherwise. +func (o *CryptFsConfig) GetPassphrase() Secret { + if o == nil || o.Passphrase == nil { + var ret Secret + return ret + } + return *o.Passphrase +} + +// GetPassphraseOk returns a tuple with the Passphrase field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CryptFsConfig) GetPassphraseOk() (*Secret, bool) { + if o == nil || o.Passphrase == nil { + return nil, false + } + return o.Passphrase, true +} + +// HasPassphrase returns a boolean if a field has been set. +func (o *CryptFsConfig) HasPassphrase() bool { + if o != nil && o.Passphrase != nil { + return true + } + + return false +} + +// SetPassphrase gets a reference to the given Secret and assigns it to the Passphrase field. +func (o *CryptFsConfig) SetPassphrase(v Secret) { + o.Passphrase = &v +} + +func (o CryptFsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Passphrase != nil { + toSerialize["passphrase"] = o.Passphrase + } + return json.Marshal(toSerialize) +} + +type NullableCryptFsConfig struct { + value *CryptFsConfig + isSet bool +} + +func (v NullableCryptFsConfig) Get() *CryptFsConfig { + return v.value +} + +func (v *NullableCryptFsConfig) Set(val *CryptFsConfig) { + v.value = val + v.isSet = true +} + +func (v NullableCryptFsConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableCryptFsConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCryptFsConfig(val *CryptFsConfig) *NullableCryptFsConfig { + return &NullableCryptFsConfig{value: val, isSet: true} +} + +func (v NullableCryptFsConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCryptFsConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_data_provider_status.go b/server/common/sftpgo/v2/openapi/model_data_provider_status.go new file mode 100644 index 00000000..1fc15644 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_data_provider_status.go @@ -0,0 +1,187 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// DataProviderStatus struct for DataProviderStatus +type DataProviderStatus struct { + IsActive *bool `json:"is_active,omitempty"` + Driver *string `json:"driver,omitempty"` + Error *string `json:"error,omitempty"` +} + +// NewDataProviderStatus instantiates a new DataProviderStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDataProviderStatus() *DataProviderStatus { + this := DataProviderStatus{} + return &this +} + +// NewDataProviderStatusWithDefaults instantiates a new DataProviderStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDataProviderStatusWithDefaults() *DataProviderStatus { + this := DataProviderStatus{} + return &this +} + +// GetIsActive returns the IsActive field value if set, zero value otherwise. +func (o *DataProviderStatus) GetIsActive() bool { + if o == nil || o.IsActive == nil { + var ret bool + return ret + } + return *o.IsActive +} + +// GetIsActiveOk returns a tuple with the IsActive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataProviderStatus) GetIsActiveOk() (*bool, bool) { + if o == nil || o.IsActive == nil { + return nil, false + } + return o.IsActive, true +} + +// HasIsActive returns a boolean if a field has been set. +func (o *DataProviderStatus) HasIsActive() bool { + if o != nil && o.IsActive != nil { + return true + } + + return false +} + +// SetIsActive gets a reference to the given bool and assigns it to the IsActive field. +func (o *DataProviderStatus) SetIsActive(v bool) { + o.IsActive = &v +} + +// GetDriver returns the Driver field value if set, zero value otherwise. +func (o *DataProviderStatus) GetDriver() string { + if o == nil || o.Driver == nil { + var ret string + return ret + } + return *o.Driver +} + +// GetDriverOk returns a tuple with the Driver field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataProviderStatus) GetDriverOk() (*string, bool) { + if o == nil || o.Driver == nil { + return nil, false + } + return o.Driver, true +} + +// HasDriver returns a boolean if a field has been set. +func (o *DataProviderStatus) HasDriver() bool { + if o != nil && o.Driver != nil { + return true + } + + return false +} + +// SetDriver gets a reference to the given string and assigns it to the Driver field. +func (o *DataProviderStatus) SetDriver(v string) { + o.Driver = &v +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *DataProviderStatus) GetError() string { + if o == nil || o.Error == nil { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataProviderStatus) GetErrorOk() (*string, bool) { + if o == nil || o.Error == nil { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *DataProviderStatus) HasError() bool { + if o != nil && o.Error != nil { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *DataProviderStatus) SetError(v string) { + o.Error = &v +} + +func (o DataProviderStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.IsActive != nil { + toSerialize["is_active"] = o.IsActive + } + if o.Driver != nil { + toSerialize["driver"] = o.Driver + } + if o.Error != nil { + toSerialize["error"] = o.Error + } + return json.Marshal(toSerialize) +} + +type NullableDataProviderStatus struct { + value *DataProviderStatus + isSet bool +} + +func (v NullableDataProviderStatus) Get() *DataProviderStatus { + return v.value +} + +func (v *NullableDataProviderStatus) Set(val *DataProviderStatus) { + v.value = val + v.isSet = true +} + +func (v NullableDataProviderStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableDataProviderStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDataProviderStatus(val *DataProviderStatus) *NullableDataProviderStatus { + return &NullableDataProviderStatus{value: val, isSet: true} +} + +func (v NullableDataProviderStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDataProviderStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_data_transfer_limit.go b/server/common/sftpgo/v2/openapi/model_data_transfer_limit.go new file mode 100644 index 00000000..258b2821 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_data_transfer_limit.go @@ -0,0 +1,227 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// DataTransferLimit struct for DataTransferLimit +type DataTransferLimit struct { + // Source networks in CIDR notation as defined in RFC 4632 and RFC 4291 for example `192.0.2.0/24` or `2001:db8::/32`. The limit applies if the defined networks contain the client IP + Sources []string `json:"sources,omitempty"` + // Maximum data transfer allowed for uploads as MB. 0 means no limit + UploadDataTransfer *int32 `json:"upload_data_transfer,omitempty"` + // Maximum data transfer allowed for downloads as MB. 0 means no limit + DownloadDataTransfer *int32 `json:"download_data_transfer,omitempty"` + // Maximum total data transfer as MB. 0 means unlimited. You can set a total data transfer instead of the individual values for uploads and downloads + TotalDataTransfer *int32 `json:"total_data_transfer,omitempty"` +} + +// NewDataTransferLimit instantiates a new DataTransferLimit object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDataTransferLimit() *DataTransferLimit { + this := DataTransferLimit{} + return &this +} + +// NewDataTransferLimitWithDefaults instantiates a new DataTransferLimit object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDataTransferLimitWithDefaults() *DataTransferLimit { + this := DataTransferLimit{} + return &this +} + +// GetSources returns the Sources field value if set, zero value otherwise. +func (o *DataTransferLimit) GetSources() []string { + if o == nil || o.Sources == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataTransferLimit) GetSourcesOk() ([]string, bool) { + if o == nil || o.Sources == nil { + return nil, false + } + return o.Sources, true +} + +// HasSources returns a boolean if a field has been set. +func (o *DataTransferLimit) HasSources() bool { + if o != nil && o.Sources != nil { + return true + } + + return false +} + +// SetSources gets a reference to the given []string and assigns it to the Sources field. +func (o *DataTransferLimit) SetSources(v []string) { + o.Sources = v +} + +// GetUploadDataTransfer returns the UploadDataTransfer field value if set, zero value otherwise. +func (o *DataTransferLimit) GetUploadDataTransfer() int32 { + if o == nil || o.UploadDataTransfer == nil { + var ret int32 + return ret + } + return *o.UploadDataTransfer +} + +// GetUploadDataTransferOk returns a tuple with the UploadDataTransfer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataTransferLimit) GetUploadDataTransferOk() (*int32, bool) { + if o == nil || o.UploadDataTransfer == nil { + return nil, false + } + return o.UploadDataTransfer, true +} + +// HasUploadDataTransfer returns a boolean if a field has been set. +func (o *DataTransferLimit) HasUploadDataTransfer() bool { + if o != nil && o.UploadDataTransfer != nil { + return true + } + + return false +} + +// SetUploadDataTransfer gets a reference to the given int32 and assigns it to the UploadDataTransfer field. +func (o *DataTransferLimit) SetUploadDataTransfer(v int32) { + o.UploadDataTransfer = &v +} + +// GetDownloadDataTransfer returns the DownloadDataTransfer field value if set, zero value otherwise. +func (o *DataTransferLimit) GetDownloadDataTransfer() int32 { + if o == nil || o.DownloadDataTransfer == nil { + var ret int32 + return ret + } + return *o.DownloadDataTransfer +} + +// GetDownloadDataTransferOk returns a tuple with the DownloadDataTransfer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataTransferLimit) GetDownloadDataTransferOk() (*int32, bool) { + if o == nil || o.DownloadDataTransfer == nil { + return nil, false + } + return o.DownloadDataTransfer, true +} + +// HasDownloadDataTransfer returns a boolean if a field has been set. +func (o *DataTransferLimit) HasDownloadDataTransfer() bool { + if o != nil && o.DownloadDataTransfer != nil { + return true + } + + return false +} + +// SetDownloadDataTransfer gets a reference to the given int32 and assigns it to the DownloadDataTransfer field. +func (o *DataTransferLimit) SetDownloadDataTransfer(v int32) { + o.DownloadDataTransfer = &v +} + +// GetTotalDataTransfer returns the TotalDataTransfer field value if set, zero value otherwise. +func (o *DataTransferLimit) GetTotalDataTransfer() int32 { + if o == nil || o.TotalDataTransfer == nil { + var ret int32 + return ret + } + return *o.TotalDataTransfer +} + +// GetTotalDataTransferOk returns a tuple with the TotalDataTransfer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataTransferLimit) GetTotalDataTransferOk() (*int32, bool) { + if o == nil || o.TotalDataTransfer == nil { + return nil, false + } + return o.TotalDataTransfer, true +} + +// HasTotalDataTransfer returns a boolean if a field has been set. +func (o *DataTransferLimit) HasTotalDataTransfer() bool { + if o != nil && o.TotalDataTransfer != nil { + return true + } + + return false +} + +// SetTotalDataTransfer gets a reference to the given int32 and assigns it to the TotalDataTransfer field. +func (o *DataTransferLimit) SetTotalDataTransfer(v int32) { + o.TotalDataTransfer = &v +} + +func (o DataTransferLimit) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Sources != nil { + toSerialize["sources"] = o.Sources + } + if o.UploadDataTransfer != nil { + toSerialize["upload_data_transfer"] = o.UploadDataTransfer + } + if o.DownloadDataTransfer != nil { + toSerialize["download_data_transfer"] = o.DownloadDataTransfer + } + if o.TotalDataTransfer != nil { + toSerialize["total_data_transfer"] = o.TotalDataTransfer + } + return json.Marshal(toSerialize) +} + +type NullableDataTransferLimit struct { + value *DataTransferLimit + isSet bool +} + +func (v NullableDataTransferLimit) Get() *DataTransferLimit { + return v.value +} + +func (v *NullableDataTransferLimit) Set(val *DataTransferLimit) { + v.value = val + v.isSet = true +} + +func (v NullableDataTransferLimit) IsSet() bool { + return v.isSet +} + +func (v *NullableDataTransferLimit) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDataTransferLimit(val *DataTransferLimit) *NullableDataTransferLimit { + return &NullableDataTransferLimit{value: val, isSet: true} +} + +func (v NullableDataTransferLimit) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDataTransferLimit) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_defender_entry.go b/server/common/sftpgo/v2/openapi/model_defender_entry.go new file mode 100644 index 00000000..f397a5d2 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_defender_entry.go @@ -0,0 +1,226 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// DefenderEntry struct for DefenderEntry +type DefenderEntry struct { + Id *string `json:"id,omitempty"` + Ip *string `json:"ip,omitempty"` + // the score increases whenever a violation is detected, such as an attempt to log in using an incorrect password or invalid username. If the score exceeds the configured threshold, the IP is banned. Omitted for banned IPs + Score *int32 `json:"score,omitempty"` + // date time until the IP is banned. For already banned hosts, the ban time is increased each time a new violation is detected. Omitted if the IP is not banned + BanTime *time.Time `json:"ban_time,omitempty"` +} + +// NewDefenderEntry instantiates a new DefenderEntry object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDefenderEntry() *DefenderEntry { + this := DefenderEntry{} + return &this +} + +// NewDefenderEntryWithDefaults instantiates a new DefenderEntry object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDefenderEntryWithDefaults() *DefenderEntry { + this := DefenderEntry{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DefenderEntry) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DefenderEntry) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *DefenderEntry) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *DefenderEntry) SetId(v string) { + o.Id = &v +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *DefenderEntry) GetIp() string { + if o == nil || o.Ip == nil { + var ret string + return ret + } + return *o.Ip +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DefenderEntry) GetIpOk() (*string, bool) { + if o == nil || o.Ip == nil { + return nil, false + } + return o.Ip, true +} + +// HasIp returns a boolean if a field has been set. +func (o *DefenderEntry) HasIp() bool { + if o != nil && o.Ip != nil { + return true + } + + return false +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *DefenderEntry) SetIp(v string) { + o.Ip = &v +} + +// GetScore returns the Score field value if set, zero value otherwise. +func (o *DefenderEntry) GetScore() int32 { + if o == nil || o.Score == nil { + var ret int32 + return ret + } + return *o.Score +} + +// GetScoreOk returns a tuple with the Score field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DefenderEntry) GetScoreOk() (*int32, bool) { + if o == nil || o.Score == nil { + return nil, false + } + return o.Score, true +} + +// HasScore returns a boolean if a field has been set. +func (o *DefenderEntry) HasScore() bool { + if o != nil && o.Score != nil { + return true + } + + return false +} + +// SetScore gets a reference to the given int32 and assigns it to the Score field. +func (o *DefenderEntry) SetScore(v int32) { + o.Score = &v +} + +// GetBanTime returns the BanTime field value if set, zero value otherwise. +func (o *DefenderEntry) GetBanTime() time.Time { + if o == nil || o.BanTime == nil { + var ret time.Time + return ret + } + return *o.BanTime +} + +// GetBanTimeOk returns a tuple with the BanTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DefenderEntry) GetBanTimeOk() (*time.Time, bool) { + if o == nil || o.BanTime == nil { + return nil, false + } + return o.BanTime, true +} + +// HasBanTime returns a boolean if a field has been set. +func (o *DefenderEntry) HasBanTime() bool { + if o != nil && o.BanTime != nil { + return true + } + + return false +} + +// SetBanTime gets a reference to the given time.Time and assigns it to the BanTime field. +func (o *DefenderEntry) SetBanTime(v time.Time) { + o.BanTime = &v +} + +func (o DefenderEntry) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Ip != nil { + toSerialize["ip"] = o.Ip + } + if o.Score != nil { + toSerialize["score"] = o.Score + } + if o.BanTime != nil { + toSerialize["ban_time"] = o.BanTime + } + return json.Marshal(toSerialize) +} + +type NullableDefenderEntry struct { + value *DefenderEntry + isSet bool +} + +func (v NullableDefenderEntry) Get() *DefenderEntry { + return v.value +} + +func (v *NullableDefenderEntry) Set(val *DefenderEntry) { + v.value = val + v.isSet = true +} + +func (v NullableDefenderEntry) IsSet() bool { + return v.isSet +} + +func (v *NullableDefenderEntry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDefenderEntry(val *DefenderEntry) *NullableDefenderEntry { + return &NullableDefenderEntry{value: val, isSet: true} +} + +func (v NullableDefenderEntry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDefenderEntry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_dir_entry.go b/server/common/sftpgo/v2/openapi/model_dir_entry.go new file mode 100644 index 00000000..4c620600 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_dir_entry.go @@ -0,0 +1,227 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// DirEntry struct for DirEntry +type DirEntry struct { + // name of the file (or subdirectory) described by the entry. This name is the final element of the path (the base name), not the entire path + Name *string `json:"name,omitempty"` + // file size, omitted for folders and non regular files + Size *int64 `json:"size,omitempty"` + // File mode and permission bits. More details here: https://golang.org/pkg/io/fs/#FileMode. Let's see some examples: - for a directory mode&2147483648 != 0 - for a symlink mode&134217728 != 0 - for a regular file mode&2401763328 == 0 + Mode *int32 `json:"mode,omitempty"` + LastModified *time.Time `json:"last_modified,omitempty"` +} + +// NewDirEntry instantiates a new DirEntry object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDirEntry() *DirEntry { + this := DirEntry{} + return &this +} + +// NewDirEntryWithDefaults instantiates a new DirEntry object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDirEntryWithDefaults() *DirEntry { + this := DirEntry{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DirEntry) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DirEntry) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *DirEntry) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DirEntry) SetName(v string) { + o.Name = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *DirEntry) GetSize() int64 { + if o == nil || o.Size == nil { + var ret int64 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DirEntry) GetSizeOk() (*int64, bool) { + if o == nil || o.Size == nil { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *DirEntry) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *DirEntry) SetSize(v int64) { + o.Size = &v +} + +// GetMode returns the Mode field value if set, zero value otherwise. +func (o *DirEntry) GetMode() int32 { + if o == nil || o.Mode == nil { + var ret int32 + return ret + } + return *o.Mode +} + +// GetModeOk returns a tuple with the Mode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DirEntry) GetModeOk() (*int32, bool) { + if o == nil || o.Mode == nil { + return nil, false + } + return o.Mode, true +} + +// HasMode returns a boolean if a field has been set. +func (o *DirEntry) HasMode() bool { + if o != nil && o.Mode != nil { + return true + } + + return false +} + +// SetMode gets a reference to the given int32 and assigns it to the Mode field. +func (o *DirEntry) SetMode(v int32) { + o.Mode = &v +} + +// GetLastModified returns the LastModified field value if set, zero value otherwise. +func (o *DirEntry) GetLastModified() time.Time { + if o == nil || o.LastModified == nil { + var ret time.Time + return ret + } + return *o.LastModified +} + +// GetLastModifiedOk returns a tuple with the LastModified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DirEntry) GetLastModifiedOk() (*time.Time, bool) { + if o == nil || o.LastModified == nil { + return nil, false + } + return o.LastModified, true +} + +// HasLastModified returns a boolean if a field has been set. +func (o *DirEntry) HasLastModified() bool { + if o != nil && o.LastModified != nil { + return true + } + + return false +} + +// SetLastModified gets a reference to the given time.Time and assigns it to the LastModified field. +func (o *DirEntry) SetLastModified(v time.Time) { + o.LastModified = &v +} + +func (o DirEntry) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Size != nil { + toSerialize["size"] = o.Size + } + if o.Mode != nil { + toSerialize["mode"] = o.Mode + } + if o.LastModified != nil { + toSerialize["last_modified"] = o.LastModified + } + return json.Marshal(toSerialize) +} + +type NullableDirEntry struct { + value *DirEntry + isSet bool +} + +func (v NullableDirEntry) Get() *DirEntry { + return v.value +} + +func (v *NullableDirEntry) Set(val *DirEntry) { + v.value = val + v.isSet = true +} + +func (v NullableDirEntry) IsSet() bool { + return v.isSet +} + +func (v *NullableDirEntry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDirEntry(val *DirEntry) *NullableDirEntry { + return &NullableDirEntry{value: val, isSet: true} +} + +func (v NullableDirEntry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDirEntry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_event_protocols.go b/server/common/sftpgo/v2/openapi/model_event_protocols.go new file mode 100644 index 00000000..79254cd7 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_event_protocols.go @@ -0,0 +1,121 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// EventProtocols Protocols: * `SSH` - SSH commands * `SFTP` - SFTP protocol * `FTP` - plain FTP and FTPES/FTPS * `DAV` - WebDAV * `HTTP` - WebClient/REST API * `DataRetention` - the event is generated by a data retention check +type EventProtocols string + +// List of EventProtocols +const ( + EVENTPROTOCOLS_SSH EventProtocols = "SSH" + EVENTPROTOCOLS_SFTP EventProtocols = "SFTP" + EVENTPROTOCOLS_SCP EventProtocols = "SCP" + EVENTPROTOCOLS_FTP EventProtocols = "FTP" + EVENTPROTOCOLS_DAV EventProtocols = "DAV" + EVENTPROTOCOLS_HTTP EventProtocols = "HTTP" + EVENTPROTOCOLS_DATA_RETENTION EventProtocols = "DataRetention" +) + +// All allowed values of EventProtocols enum +var AllowedEventProtocolsEnumValues = []EventProtocols{ + "SSH", + "SFTP", + "SCP", + "FTP", + "DAV", + "HTTP", + "DataRetention", +} + +func (v *EventProtocols) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := EventProtocols(value) + for _, existing := range AllowedEventProtocolsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid EventProtocols", value) +} + +// NewEventProtocolsFromValue returns a pointer to a valid EventProtocols +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewEventProtocolsFromValue(v string) (*EventProtocols, error) { + ev := EventProtocols(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for EventProtocols: valid values are %v", v, AllowedEventProtocolsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v EventProtocols) IsValid() bool { + for _, existing := range AllowedEventProtocolsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EventProtocols value +func (v EventProtocols) Ptr() *EventProtocols { + return &v +} + +type NullableEventProtocols struct { + value *EventProtocols + isSet bool +} + +func (v NullableEventProtocols) Get() *EventProtocols { + return v.value +} + +func (v *NullableEventProtocols) Set(val *EventProtocols) { + v.value = val + v.isSet = true +} + +func (v NullableEventProtocols) IsSet() bool { + return v.isSet +} + +func (v *NullableEventProtocols) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEventProtocols(val *EventProtocols) *NullableEventProtocols { + return &NullableEventProtocols{value: val, isSet: true} +} + +func (v NullableEventProtocols) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEventProtocols) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_filesystem_config.go b/server/common/sftpgo/v2/openapi/model_filesystem_config.go new file mode 100644 index 00000000..220aff56 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_filesystem_config.go @@ -0,0 +1,295 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// FilesystemConfig Storage filesystem details +type FilesystemConfig struct { + Provider *FsProviders `json:"provider,omitempty"` + S3config *S3Config `json:"s3config,omitempty"` + Gcsconfig *GCSConfig `json:"gcsconfig,omitempty"` + Azblobconfig *AzureBlobFsConfig `json:"azblobconfig,omitempty"` + Cryptconfig *CryptFsConfig `json:"cryptconfig,omitempty"` + Sftpconfig *SFTPFsConfig `json:"sftpconfig,omitempty"` +} + +// NewFilesystemConfig instantiates a new FilesystemConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFilesystemConfig() *FilesystemConfig { + this := FilesystemConfig{} + return &this +} + +// NewFilesystemConfigWithDefaults instantiates a new FilesystemConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFilesystemConfigWithDefaults() *FilesystemConfig { + this := FilesystemConfig{} + return &this +} + +// GetProvider returns the Provider field value if set, zero value otherwise. +func (o *FilesystemConfig) GetProvider() FsProviders { + if o == nil || o.Provider == nil { + var ret FsProviders + return ret + } + return *o.Provider +} + +// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilesystemConfig) GetProviderOk() (*FsProviders, bool) { + if o == nil || o.Provider == nil { + return nil, false + } + return o.Provider, true +} + +// HasProvider returns a boolean if a field has been set. +func (o *FilesystemConfig) HasProvider() bool { + if o != nil && o.Provider != nil { + return true + } + + return false +} + +// SetProvider gets a reference to the given FsProviders and assigns it to the Provider field. +func (o *FilesystemConfig) SetProvider(v FsProviders) { + o.Provider = &v +} + +// GetS3config returns the S3config field value if set, zero value otherwise. +func (o *FilesystemConfig) GetS3config() S3Config { + if o == nil || o.S3config == nil { + var ret S3Config + return ret + } + return *o.S3config +} + +// GetS3configOk returns a tuple with the S3config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilesystemConfig) GetS3configOk() (*S3Config, bool) { + if o == nil || o.S3config == nil { + return nil, false + } + return o.S3config, true +} + +// HasS3config returns a boolean if a field has been set. +func (o *FilesystemConfig) HasS3config() bool { + if o != nil && o.S3config != nil { + return true + } + + return false +} + +// SetS3config gets a reference to the given S3Config and assigns it to the S3config field. +func (o *FilesystemConfig) SetS3config(v S3Config) { + o.S3config = &v +} + +// GetGcsconfig returns the Gcsconfig field value if set, zero value otherwise. +func (o *FilesystemConfig) GetGcsconfig() GCSConfig { + if o == nil || o.Gcsconfig == nil { + var ret GCSConfig + return ret + } + return *o.Gcsconfig +} + +// GetGcsconfigOk returns a tuple with the Gcsconfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilesystemConfig) GetGcsconfigOk() (*GCSConfig, bool) { + if o == nil || o.Gcsconfig == nil { + return nil, false + } + return o.Gcsconfig, true +} + +// HasGcsconfig returns a boolean if a field has been set. +func (o *FilesystemConfig) HasGcsconfig() bool { + if o != nil && o.Gcsconfig != nil { + return true + } + + return false +} + +// SetGcsconfig gets a reference to the given GCSConfig and assigns it to the Gcsconfig field. +func (o *FilesystemConfig) SetGcsconfig(v GCSConfig) { + o.Gcsconfig = &v +} + +// GetAzblobconfig returns the Azblobconfig field value if set, zero value otherwise. +func (o *FilesystemConfig) GetAzblobconfig() AzureBlobFsConfig { + if o == nil || o.Azblobconfig == nil { + var ret AzureBlobFsConfig + return ret + } + return *o.Azblobconfig +} + +// GetAzblobconfigOk returns a tuple with the Azblobconfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilesystemConfig) GetAzblobconfigOk() (*AzureBlobFsConfig, bool) { + if o == nil || o.Azblobconfig == nil { + return nil, false + } + return o.Azblobconfig, true +} + +// HasAzblobconfig returns a boolean if a field has been set. +func (o *FilesystemConfig) HasAzblobconfig() bool { + if o != nil && o.Azblobconfig != nil { + return true + } + + return false +} + +// SetAzblobconfig gets a reference to the given AzureBlobFsConfig and assigns it to the Azblobconfig field. +func (o *FilesystemConfig) SetAzblobconfig(v AzureBlobFsConfig) { + o.Azblobconfig = &v +} + +// GetCryptconfig returns the Cryptconfig field value if set, zero value otherwise. +func (o *FilesystemConfig) GetCryptconfig() CryptFsConfig { + if o == nil || o.Cryptconfig == nil { + var ret CryptFsConfig + return ret + } + return *o.Cryptconfig +} + +// GetCryptconfigOk returns a tuple with the Cryptconfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilesystemConfig) GetCryptconfigOk() (*CryptFsConfig, bool) { + if o == nil || o.Cryptconfig == nil { + return nil, false + } + return o.Cryptconfig, true +} + +// HasCryptconfig returns a boolean if a field has been set. +func (o *FilesystemConfig) HasCryptconfig() bool { + if o != nil && o.Cryptconfig != nil { + return true + } + + return false +} + +// SetCryptconfig gets a reference to the given CryptFsConfig and assigns it to the Cryptconfig field. +func (o *FilesystemConfig) SetCryptconfig(v CryptFsConfig) { + o.Cryptconfig = &v +} + +// GetSftpconfig returns the Sftpconfig field value if set, zero value otherwise. +func (o *FilesystemConfig) GetSftpconfig() SFTPFsConfig { + if o == nil || o.Sftpconfig == nil { + var ret SFTPFsConfig + return ret + } + return *o.Sftpconfig +} + +// GetSftpconfigOk returns a tuple with the Sftpconfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilesystemConfig) GetSftpconfigOk() (*SFTPFsConfig, bool) { + if o == nil || o.Sftpconfig == nil { + return nil, false + } + return o.Sftpconfig, true +} + +// HasSftpconfig returns a boolean if a field has been set. +func (o *FilesystemConfig) HasSftpconfig() bool { + if o != nil && o.Sftpconfig != nil { + return true + } + + return false +} + +// SetSftpconfig gets a reference to the given SFTPFsConfig and assigns it to the Sftpconfig field. +func (o *FilesystemConfig) SetSftpconfig(v SFTPFsConfig) { + o.Sftpconfig = &v +} + +func (o FilesystemConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Provider != nil { + toSerialize["provider"] = o.Provider + } + if o.S3config != nil { + toSerialize["s3config"] = o.S3config + } + if o.Gcsconfig != nil { + toSerialize["gcsconfig"] = o.Gcsconfig + } + if o.Azblobconfig != nil { + toSerialize["azblobconfig"] = o.Azblobconfig + } + if o.Cryptconfig != nil { + toSerialize["cryptconfig"] = o.Cryptconfig + } + if o.Sftpconfig != nil { + toSerialize["sftpconfig"] = o.Sftpconfig + } + return json.Marshal(toSerialize) +} + +type NullableFilesystemConfig struct { + value *FilesystemConfig + isSet bool +} + +func (v NullableFilesystemConfig) Get() *FilesystemConfig { + return v.value +} + +func (v *NullableFilesystemConfig) Set(val *FilesystemConfig) { + v.value = val + v.isSet = true +} + +func (v NullableFilesystemConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableFilesystemConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFilesystemConfig(val *FilesystemConfig) *NullableFilesystemConfig { + return &NullableFilesystemConfig{value: val, isSet: true} +} + +func (v NullableFilesystemConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFilesystemConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_folder_quota_scan.go b/server/common/sftpgo/v2/openapi/model_folder_quota_scan.go new file mode 100644 index 00000000..3fae5186 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_folder_quota_scan.go @@ -0,0 +1,153 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// FolderQuotaScan struct for FolderQuotaScan +type FolderQuotaScan struct { + // folder name to which the quota scan refers + Name *string `json:"name,omitempty"` + // scan start time as unix timestamp in milliseconds + StartTime *int64 `json:"start_time,omitempty"` +} + +// NewFolderQuotaScan instantiates a new FolderQuotaScan object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFolderQuotaScan() *FolderQuotaScan { + this := FolderQuotaScan{} + return &this +} + +// NewFolderQuotaScanWithDefaults instantiates a new FolderQuotaScan object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFolderQuotaScanWithDefaults() *FolderQuotaScan { + this := FolderQuotaScan{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *FolderQuotaScan) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FolderQuotaScan) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *FolderQuotaScan) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *FolderQuotaScan) SetName(v string) { + o.Name = &v +} + +// GetStartTime returns the StartTime field value if set, zero value otherwise. +func (o *FolderQuotaScan) GetStartTime() int64 { + if o == nil || o.StartTime == nil { + var ret int64 + return ret + } + return *o.StartTime +} + +// GetStartTimeOk returns a tuple with the StartTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FolderQuotaScan) GetStartTimeOk() (*int64, bool) { + if o == nil || o.StartTime == nil { + return nil, false + } + return o.StartTime, true +} + +// HasStartTime returns a boolean if a field has been set. +func (o *FolderQuotaScan) HasStartTime() bool { + if o != nil && o.StartTime != nil { + return true + } + + return false +} + +// SetStartTime gets a reference to the given int64 and assigns it to the StartTime field. +func (o *FolderQuotaScan) SetStartTime(v int64) { + o.StartTime = &v +} + +func (o FolderQuotaScan) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.StartTime != nil { + toSerialize["start_time"] = o.StartTime + } + return json.Marshal(toSerialize) +} + +type NullableFolderQuotaScan struct { + value *FolderQuotaScan + isSet bool +} + +func (v NullableFolderQuotaScan) Get() *FolderQuotaScan { + return v.value +} + +func (v *NullableFolderQuotaScan) Set(val *FolderQuotaScan) { + v.value = val + v.isSet = true +} + +func (v NullableFolderQuotaScan) IsSet() bool { + return v.isSet +} + +func (v *NullableFolderQuotaScan) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFolderQuotaScan(val *FolderQuotaScan) *NullableFolderQuotaScan { + return &NullableFolderQuotaScan{value: val, isSet: true} +} + +func (v NullableFolderQuotaScan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFolderQuotaScan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_folder_retention.go b/server/common/sftpgo/v2/openapi/model_folder_retention.go new file mode 100644 index 00000000..15f974cb --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_folder_retention.go @@ -0,0 +1,227 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// FolderRetention struct for FolderRetention +type FolderRetention struct { + // exposed virtual directory path, if no other specific retention is defined, the retention applies for sub directories too. For example if retention is defined for the paths \"/\" and \"/sub\" then the retention for \"/\" is applied for any file outside the \"/sub\" directory + Path *string `json:"path,omitempty"` + // retention time in hours. All the files with a modification time older than the defined value will be deleted. 0 means exclude this path + Retention *int32 `json:"retention,omitempty"` + // if enabled, empty directories will be deleted + DeleteEmptyDirs *bool `json:"delete_empty_dirs,omitempty"` + // if enabled, files will be deleted even if the user does not have the delete permission. The default is \"false\" which means that files will be skipped if the user does not have permission to delete them. File patterns filters will always be silently ignored + IgnoreUserPermissions *bool `json:"ignore_user_permissions,omitempty"` +} + +// NewFolderRetention instantiates a new FolderRetention object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFolderRetention() *FolderRetention { + this := FolderRetention{} + return &this +} + +// NewFolderRetentionWithDefaults instantiates a new FolderRetention object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFolderRetentionWithDefaults() *FolderRetention { + this := FolderRetention{} + return &this +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *FolderRetention) GetPath() string { + if o == nil || o.Path == nil { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FolderRetention) GetPathOk() (*string, bool) { + if o == nil || o.Path == nil { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *FolderRetention) HasPath() bool { + if o != nil && o.Path != nil { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *FolderRetention) SetPath(v string) { + o.Path = &v +} + +// GetRetention returns the Retention field value if set, zero value otherwise. +func (o *FolderRetention) GetRetention() int32 { + if o == nil || o.Retention == nil { + var ret int32 + return ret + } + return *o.Retention +} + +// GetRetentionOk returns a tuple with the Retention field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FolderRetention) GetRetentionOk() (*int32, bool) { + if o == nil || o.Retention == nil { + return nil, false + } + return o.Retention, true +} + +// HasRetention returns a boolean if a field has been set. +func (o *FolderRetention) HasRetention() bool { + if o != nil && o.Retention != nil { + return true + } + + return false +} + +// SetRetention gets a reference to the given int32 and assigns it to the Retention field. +func (o *FolderRetention) SetRetention(v int32) { + o.Retention = &v +} + +// GetDeleteEmptyDirs returns the DeleteEmptyDirs field value if set, zero value otherwise. +func (o *FolderRetention) GetDeleteEmptyDirs() bool { + if o == nil || o.DeleteEmptyDirs == nil { + var ret bool + return ret + } + return *o.DeleteEmptyDirs +} + +// GetDeleteEmptyDirsOk returns a tuple with the DeleteEmptyDirs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FolderRetention) GetDeleteEmptyDirsOk() (*bool, bool) { + if o == nil || o.DeleteEmptyDirs == nil { + return nil, false + } + return o.DeleteEmptyDirs, true +} + +// HasDeleteEmptyDirs returns a boolean if a field has been set. +func (o *FolderRetention) HasDeleteEmptyDirs() bool { + if o != nil && o.DeleteEmptyDirs != nil { + return true + } + + return false +} + +// SetDeleteEmptyDirs gets a reference to the given bool and assigns it to the DeleteEmptyDirs field. +func (o *FolderRetention) SetDeleteEmptyDirs(v bool) { + o.DeleteEmptyDirs = &v +} + +// GetIgnoreUserPermissions returns the IgnoreUserPermissions field value if set, zero value otherwise. +func (o *FolderRetention) GetIgnoreUserPermissions() bool { + if o == nil || o.IgnoreUserPermissions == nil { + var ret bool + return ret + } + return *o.IgnoreUserPermissions +} + +// GetIgnoreUserPermissionsOk returns a tuple with the IgnoreUserPermissions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FolderRetention) GetIgnoreUserPermissionsOk() (*bool, bool) { + if o == nil || o.IgnoreUserPermissions == nil { + return nil, false + } + return o.IgnoreUserPermissions, true +} + +// HasIgnoreUserPermissions returns a boolean if a field has been set. +func (o *FolderRetention) HasIgnoreUserPermissions() bool { + if o != nil && o.IgnoreUserPermissions != nil { + return true + } + + return false +} + +// SetIgnoreUserPermissions gets a reference to the given bool and assigns it to the IgnoreUserPermissions field. +func (o *FolderRetention) SetIgnoreUserPermissions(v bool) { + o.IgnoreUserPermissions = &v +} + +func (o FolderRetention) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Path != nil { + toSerialize["path"] = o.Path + } + if o.Retention != nil { + toSerialize["retention"] = o.Retention + } + if o.DeleteEmptyDirs != nil { + toSerialize["delete_empty_dirs"] = o.DeleteEmptyDirs + } + if o.IgnoreUserPermissions != nil { + toSerialize["ignore_user_permissions"] = o.IgnoreUserPermissions + } + return json.Marshal(toSerialize) +} + +type NullableFolderRetention struct { + value *FolderRetention + isSet bool +} + +func (v NullableFolderRetention) Get() *FolderRetention { + return v.value +} + +func (v *NullableFolderRetention) Set(val *FolderRetention) { + v.value = val + v.isSet = true +} + +func (v NullableFolderRetention) IsSet() bool { + return v.isSet +} + +func (v *NullableFolderRetention) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFolderRetention(val *FolderRetention) *NullableFolderRetention { + return &NullableFolderRetention{value: val, isSet: true} +} + +func (v NullableFolderRetention) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFolderRetention) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_fs_event.go b/server/common/sftpgo/v2/openapi/model_fs_event.go new file mode 100644 index 00000000..76ed71ae --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_fs_event.go @@ -0,0 +1,764 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// FsEvent struct for FsEvent +type FsEvent struct { + Id *string `json:"id,omitempty"` + // unix timestamp in nanoseconds + Timestamp *int64 `json:"timestamp,omitempty"` + Action *FsEventAction `json:"action,omitempty"` + Username *string `json:"username,omitempty"` + FsPath *string `json:"fs_path,omitempty"` + FsTargetPath *string `json:"fs_target_path,omitempty"` + VirtualPath *string `json:"virtual_path,omitempty"` + VirtualTargetPath *string `json:"virtual_target_path,omitempty"` + SshCmd *string `json:"ssh_cmd,omitempty"` + FileSize *int64 `json:"file_size,omitempty"` + Status *FsEventStatus `json:"status,omitempty"` + Protocol *EventProtocols `json:"protocol,omitempty"` + Ip *string `json:"ip,omitempty"` + SessionId *string `json:"session_id,omitempty"` + FsProvider *FsProviders `json:"fs_provider,omitempty"` + Bucket *string `json:"bucket,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + OpenFlags *string `json:"open_flags,omitempty"` + InstanceId *string `json:"instance_id,omitempty"` +} + +// NewFsEvent instantiates a new FsEvent object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFsEvent() *FsEvent { + this := FsEvent{} + return &this +} + +// NewFsEventWithDefaults instantiates a new FsEvent object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFsEventWithDefaults() *FsEvent { + this := FsEvent{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *FsEvent) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *FsEvent) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *FsEvent) SetId(v string) { + o.Id = &v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *FsEvent) GetTimestamp() int64 { + if o == nil || o.Timestamp == nil { + var ret int64 + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetTimestampOk() (*int64, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *FsEvent) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given int64 and assigns it to the Timestamp field. +func (o *FsEvent) SetTimestamp(v int64) { + o.Timestamp = &v +} + +// GetAction returns the Action field value if set, zero value otherwise. +func (o *FsEvent) GetAction() FsEventAction { + if o == nil || o.Action == nil { + var ret FsEventAction + return ret + } + return *o.Action +} + +// GetActionOk returns a tuple with the Action field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetActionOk() (*FsEventAction, bool) { + if o == nil || o.Action == nil { + return nil, false + } + return o.Action, true +} + +// HasAction returns a boolean if a field has been set. +func (o *FsEvent) HasAction() bool { + if o != nil && o.Action != nil { + return true + } + + return false +} + +// SetAction gets a reference to the given FsEventAction and assigns it to the Action field. +func (o *FsEvent) SetAction(v FsEventAction) { + o.Action = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *FsEvent) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *FsEvent) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *FsEvent) SetUsername(v string) { + o.Username = &v +} + +// GetFsPath returns the FsPath field value if set, zero value otherwise. +func (o *FsEvent) GetFsPath() string { + if o == nil || o.FsPath == nil { + var ret string + return ret + } + return *o.FsPath +} + +// GetFsPathOk returns a tuple with the FsPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetFsPathOk() (*string, bool) { + if o == nil || o.FsPath == nil { + return nil, false + } + return o.FsPath, true +} + +// HasFsPath returns a boolean if a field has been set. +func (o *FsEvent) HasFsPath() bool { + if o != nil && o.FsPath != nil { + return true + } + + return false +} + +// SetFsPath gets a reference to the given string and assigns it to the FsPath field. +func (o *FsEvent) SetFsPath(v string) { + o.FsPath = &v +} + +// GetFsTargetPath returns the FsTargetPath field value if set, zero value otherwise. +func (o *FsEvent) GetFsTargetPath() string { + if o == nil || o.FsTargetPath == nil { + var ret string + return ret + } + return *o.FsTargetPath +} + +// GetFsTargetPathOk returns a tuple with the FsTargetPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetFsTargetPathOk() (*string, bool) { + if o == nil || o.FsTargetPath == nil { + return nil, false + } + return o.FsTargetPath, true +} + +// HasFsTargetPath returns a boolean if a field has been set. +func (o *FsEvent) HasFsTargetPath() bool { + if o != nil && o.FsTargetPath != nil { + return true + } + + return false +} + +// SetFsTargetPath gets a reference to the given string and assigns it to the FsTargetPath field. +func (o *FsEvent) SetFsTargetPath(v string) { + o.FsTargetPath = &v +} + +// GetVirtualPath returns the VirtualPath field value if set, zero value otherwise. +func (o *FsEvent) GetVirtualPath() string { + if o == nil || o.VirtualPath == nil { + var ret string + return ret + } + return *o.VirtualPath +} + +// GetVirtualPathOk returns a tuple with the VirtualPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetVirtualPathOk() (*string, bool) { + if o == nil || o.VirtualPath == nil { + return nil, false + } + return o.VirtualPath, true +} + +// HasVirtualPath returns a boolean if a field has been set. +func (o *FsEvent) HasVirtualPath() bool { + if o != nil && o.VirtualPath != nil { + return true + } + + return false +} + +// SetVirtualPath gets a reference to the given string and assigns it to the VirtualPath field. +func (o *FsEvent) SetVirtualPath(v string) { + o.VirtualPath = &v +} + +// GetVirtualTargetPath returns the VirtualTargetPath field value if set, zero value otherwise. +func (o *FsEvent) GetVirtualTargetPath() string { + if o == nil || o.VirtualTargetPath == nil { + var ret string + return ret + } + return *o.VirtualTargetPath +} + +// GetVirtualTargetPathOk returns a tuple with the VirtualTargetPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetVirtualTargetPathOk() (*string, bool) { + if o == nil || o.VirtualTargetPath == nil { + return nil, false + } + return o.VirtualTargetPath, true +} + +// HasVirtualTargetPath returns a boolean if a field has been set. +func (o *FsEvent) HasVirtualTargetPath() bool { + if o != nil && o.VirtualTargetPath != nil { + return true + } + + return false +} + +// SetVirtualTargetPath gets a reference to the given string and assigns it to the VirtualTargetPath field. +func (o *FsEvent) SetVirtualTargetPath(v string) { + o.VirtualTargetPath = &v +} + +// GetSshCmd returns the SshCmd field value if set, zero value otherwise. +func (o *FsEvent) GetSshCmd() string { + if o == nil || o.SshCmd == nil { + var ret string + return ret + } + return *o.SshCmd +} + +// GetSshCmdOk returns a tuple with the SshCmd field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetSshCmdOk() (*string, bool) { + if o == nil || o.SshCmd == nil { + return nil, false + } + return o.SshCmd, true +} + +// HasSshCmd returns a boolean if a field has been set. +func (o *FsEvent) HasSshCmd() bool { + if o != nil && o.SshCmd != nil { + return true + } + + return false +} + +// SetSshCmd gets a reference to the given string and assigns it to the SshCmd field. +func (o *FsEvent) SetSshCmd(v string) { + o.SshCmd = &v +} + +// GetFileSize returns the FileSize field value if set, zero value otherwise. +func (o *FsEvent) GetFileSize() int64 { + if o == nil || o.FileSize == nil { + var ret int64 + return ret + } + return *o.FileSize +} + +// GetFileSizeOk returns a tuple with the FileSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetFileSizeOk() (*int64, bool) { + if o == nil || o.FileSize == nil { + return nil, false + } + return o.FileSize, true +} + +// HasFileSize returns a boolean if a field has been set. +func (o *FsEvent) HasFileSize() bool { + if o != nil && o.FileSize != nil { + return true + } + + return false +} + +// SetFileSize gets a reference to the given int64 and assigns it to the FileSize field. +func (o *FsEvent) SetFileSize(v int64) { + o.FileSize = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *FsEvent) GetStatus() FsEventStatus { + if o == nil || o.Status == nil { + var ret FsEventStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetStatusOk() (*FsEventStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *FsEvent) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given FsEventStatus and assigns it to the Status field. +func (o *FsEvent) SetStatus(v FsEventStatus) { + o.Status = &v +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *FsEvent) GetProtocol() EventProtocols { + if o == nil || o.Protocol == nil { + var ret EventProtocols + return ret + } + return *o.Protocol +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetProtocolOk() (*EventProtocols, bool) { + if o == nil || o.Protocol == nil { + return nil, false + } + return o.Protocol, true +} + +// HasProtocol returns a boolean if a field has been set. +func (o *FsEvent) HasProtocol() bool { + if o != nil && o.Protocol != nil { + return true + } + + return false +} + +// SetProtocol gets a reference to the given EventProtocols and assigns it to the Protocol field. +func (o *FsEvent) SetProtocol(v EventProtocols) { + o.Protocol = &v +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *FsEvent) GetIp() string { + if o == nil || o.Ip == nil { + var ret string + return ret + } + return *o.Ip +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetIpOk() (*string, bool) { + if o == nil || o.Ip == nil { + return nil, false + } + return o.Ip, true +} + +// HasIp returns a boolean if a field has been set. +func (o *FsEvent) HasIp() bool { + if o != nil && o.Ip != nil { + return true + } + + return false +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *FsEvent) SetIp(v string) { + o.Ip = &v +} + +// GetSessionId returns the SessionId field value if set, zero value otherwise. +func (o *FsEvent) GetSessionId() string { + if o == nil || o.SessionId == nil { + var ret string + return ret + } + return *o.SessionId +} + +// GetSessionIdOk returns a tuple with the SessionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetSessionIdOk() (*string, bool) { + if o == nil || o.SessionId == nil { + return nil, false + } + return o.SessionId, true +} + +// HasSessionId returns a boolean if a field has been set. +func (o *FsEvent) HasSessionId() bool { + if o != nil && o.SessionId != nil { + return true + } + + return false +} + +// SetSessionId gets a reference to the given string and assigns it to the SessionId field. +func (o *FsEvent) SetSessionId(v string) { + o.SessionId = &v +} + +// GetFsProvider returns the FsProvider field value if set, zero value otherwise. +func (o *FsEvent) GetFsProvider() FsProviders { + if o == nil || o.FsProvider == nil { + var ret FsProviders + return ret + } + return *o.FsProvider +} + +// GetFsProviderOk returns a tuple with the FsProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetFsProviderOk() (*FsProviders, bool) { + if o == nil || o.FsProvider == nil { + return nil, false + } + return o.FsProvider, true +} + +// HasFsProvider returns a boolean if a field has been set. +func (o *FsEvent) HasFsProvider() bool { + if o != nil && o.FsProvider != nil { + return true + } + + return false +} + +// SetFsProvider gets a reference to the given FsProviders and assigns it to the FsProvider field. +func (o *FsEvent) SetFsProvider(v FsProviders) { + o.FsProvider = &v +} + +// GetBucket returns the Bucket field value if set, zero value otherwise. +func (o *FsEvent) GetBucket() string { + if o == nil || o.Bucket == nil { + var ret string + return ret + } + return *o.Bucket +} + +// GetBucketOk returns a tuple with the Bucket field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetBucketOk() (*string, bool) { + if o == nil || o.Bucket == nil { + return nil, false + } + return o.Bucket, true +} + +// HasBucket returns a boolean if a field has been set. +func (o *FsEvent) HasBucket() bool { + if o != nil && o.Bucket != nil { + return true + } + + return false +} + +// SetBucket gets a reference to the given string and assigns it to the Bucket field. +func (o *FsEvent) SetBucket(v string) { + o.Bucket = &v +} + +// GetEndpoint returns the Endpoint field value if set, zero value otherwise. +func (o *FsEvent) GetEndpoint() string { + if o == nil || o.Endpoint == nil { + var ret string + return ret + } + return *o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetEndpointOk() (*string, bool) { + if o == nil || o.Endpoint == nil { + return nil, false + } + return o.Endpoint, true +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *FsEvent) HasEndpoint() bool { + if o != nil && o.Endpoint != nil { + return true + } + + return false +} + +// SetEndpoint gets a reference to the given string and assigns it to the Endpoint field. +func (o *FsEvent) SetEndpoint(v string) { + o.Endpoint = &v +} + +// GetOpenFlags returns the OpenFlags field value if set, zero value otherwise. +func (o *FsEvent) GetOpenFlags() string { + if o == nil || o.OpenFlags == nil { + var ret string + return ret + } + return *o.OpenFlags +} + +// GetOpenFlagsOk returns a tuple with the OpenFlags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetOpenFlagsOk() (*string, bool) { + if o == nil || o.OpenFlags == nil { + return nil, false + } + return o.OpenFlags, true +} + +// HasOpenFlags returns a boolean if a field has been set. +func (o *FsEvent) HasOpenFlags() bool { + if o != nil && o.OpenFlags != nil { + return true + } + + return false +} + +// SetOpenFlags gets a reference to the given string and assigns it to the OpenFlags field. +func (o *FsEvent) SetOpenFlags(v string) { + o.OpenFlags = &v +} + +// GetInstanceId returns the InstanceId field value if set, zero value otherwise. +func (o *FsEvent) GetInstanceId() string { + if o == nil || o.InstanceId == nil { + var ret string + return ret + } + return *o.InstanceId +} + +// GetInstanceIdOk returns a tuple with the InstanceId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FsEvent) GetInstanceIdOk() (*string, bool) { + if o == nil || o.InstanceId == nil { + return nil, false + } + return o.InstanceId, true +} + +// HasInstanceId returns a boolean if a field has been set. +func (o *FsEvent) HasInstanceId() bool { + if o != nil && o.InstanceId != nil { + return true + } + + return false +} + +// SetInstanceId gets a reference to the given string and assigns it to the InstanceId field. +func (o *FsEvent) SetInstanceId(v string) { + o.InstanceId = &v +} + +func (o FsEvent) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Timestamp != nil { + toSerialize["timestamp"] = o.Timestamp + } + if o.Action != nil { + toSerialize["action"] = o.Action + } + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.FsPath != nil { + toSerialize["fs_path"] = o.FsPath + } + if o.FsTargetPath != nil { + toSerialize["fs_target_path"] = o.FsTargetPath + } + if o.VirtualPath != nil { + toSerialize["virtual_path"] = o.VirtualPath + } + if o.VirtualTargetPath != nil { + toSerialize["virtual_target_path"] = o.VirtualTargetPath + } + if o.SshCmd != nil { + toSerialize["ssh_cmd"] = o.SshCmd + } + if o.FileSize != nil { + toSerialize["file_size"] = o.FileSize + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Protocol != nil { + toSerialize["protocol"] = o.Protocol + } + if o.Ip != nil { + toSerialize["ip"] = o.Ip + } + if o.SessionId != nil { + toSerialize["session_id"] = o.SessionId + } + if o.FsProvider != nil { + toSerialize["fs_provider"] = o.FsProvider + } + if o.Bucket != nil { + toSerialize["bucket"] = o.Bucket + } + if o.Endpoint != nil { + toSerialize["endpoint"] = o.Endpoint + } + if o.OpenFlags != nil { + toSerialize["open_flags"] = o.OpenFlags + } + if o.InstanceId != nil { + toSerialize["instance_id"] = o.InstanceId + } + return json.Marshal(toSerialize) +} + +type NullableFsEvent struct { + value *FsEvent + isSet bool +} + +func (v NullableFsEvent) Get() *FsEvent { + return v.value +} + +func (v *NullableFsEvent) Set(val *FsEvent) { + v.value = val + v.isSet = true +} + +func (v NullableFsEvent) IsSet() bool { + return v.isSet +} + +func (v *NullableFsEvent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFsEvent(val *FsEvent) *NullableFsEvent { + return &NullableFsEvent{value: val, isSet: true} +} + +func (v NullableFsEvent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFsEvent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_fs_event_action.go b/server/common/sftpgo/v2/openapi/model_fs_event_action.go new file mode 100644 index 00000000..835e0703 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_fs_event_action.go @@ -0,0 +1,123 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// FsEventAction the model 'FsEventAction' +type FsEventAction string + +// List of FsEventAction +const ( + FSEVENTACTION_DOWNLOAD FsEventAction = "download" + FSEVENTACTION_PRE_UPLOAD FsEventAction = "pre-upload" + FSEVENTACTION_UPLOAD FsEventAction = "upload" + FSEVENTACTION_DELETE FsEventAction = "delete" + FSEVENTACTION_RENAME FsEventAction = "rename" + FSEVENTACTION_MKDIR FsEventAction = "mkdir" + FSEVENTACTION_RMDIR FsEventAction = "rmdir" + FSEVENTACTION_SSH_CMD FsEventAction = "ssh_cmd" +) + +// All allowed values of FsEventAction enum +var AllowedFsEventActionEnumValues = []FsEventAction{ + "download", + "pre-upload", + "upload", + "delete", + "rename", + "mkdir", + "rmdir", + "ssh_cmd", +} + +func (v *FsEventAction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FsEventAction(value) + for _, existing := range AllowedFsEventActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FsEventAction", value) +} + +// NewFsEventActionFromValue returns a pointer to a valid FsEventAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFsEventActionFromValue(v string) (*FsEventAction, error) { + ev := FsEventAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FsEventAction: valid values are %v", v, AllowedFsEventActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FsEventAction) IsValid() bool { + for _, existing := range AllowedFsEventActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FsEventAction value +func (v FsEventAction) Ptr() *FsEventAction { + return &v +} + +type NullableFsEventAction struct { + value *FsEventAction + isSet bool +} + +func (v NullableFsEventAction) Get() *FsEventAction { + return v.value +} + +func (v *NullableFsEventAction) Set(val *FsEventAction) { + v.value = val + v.isSet = true +} + +func (v NullableFsEventAction) IsSet() bool { + return v.isSet +} + +func (v *NullableFsEventAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFsEventAction(val *FsEventAction) *NullableFsEventAction { + return &NullableFsEventAction{value: val, isSet: true} +} + +func (v NullableFsEventAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFsEventAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_fs_event_status.go b/server/common/sftpgo/v2/openapi/model_fs_event_status.go new file mode 100644 index 00000000..b76048d0 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_fs_event_status.go @@ -0,0 +1,113 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// FsEventStatus Event status: * `1` - no error * `2` - generic error * `3` - quota exceeded error +type FsEventStatus int32 + +// List of FsEventStatus +const ( + FSEVENTSTATUS__1 FsEventStatus = 1 + FSEVENTSTATUS__2 FsEventStatus = 2 + FSEVENTSTATUS__3 FsEventStatus = 3 +) + +// All allowed values of FsEventStatus enum +var AllowedFsEventStatusEnumValues = []FsEventStatus{ + 1, + 2, + 3, +} + +func (v *FsEventStatus) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FsEventStatus(value) + for _, existing := range AllowedFsEventStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FsEventStatus", value) +} + +// NewFsEventStatusFromValue returns a pointer to a valid FsEventStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFsEventStatusFromValue(v int32) (*FsEventStatus, error) { + ev := FsEventStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FsEventStatus: valid values are %v", v, AllowedFsEventStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FsEventStatus) IsValid() bool { + for _, existing := range AllowedFsEventStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FsEventStatus value +func (v FsEventStatus) Ptr() *FsEventStatus { + return &v +} + +type NullableFsEventStatus struct { + value *FsEventStatus + isSet bool +} + +func (v NullableFsEventStatus) Get() *FsEventStatus { + return v.value +} + +func (v *NullableFsEventStatus) Set(val *FsEventStatus) { + v.value = val + v.isSet = true +} + +func (v NullableFsEventStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableFsEventStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFsEventStatus(val *FsEventStatus) *NullableFsEventStatus { + return &NullableFsEventStatus{value: val, isSet: true} +} + +func (v NullableFsEventStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFsEventStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_fs_providers.go b/server/common/sftpgo/v2/openapi/model_fs_providers.go new file mode 100644 index 00000000..c351900a --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_fs_providers.go @@ -0,0 +1,119 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// FsProviders Filesystem providers: * `0` - Local filesystem * `1` - S3 Compatible Object Storage * `2` - Google Cloud Storage * `3` - Azure Blob Storage * `4` - Local filesystem encrypted * `5` - SFTP +type FsProviders int32 + +// List of FsProviders +const ( + FSPROVIDERS__0 FsProviders = 0 + FSPROVIDERS__1 FsProviders = 1 + FSPROVIDERS__2 FsProviders = 2 + FSPROVIDERS__3 FsProviders = 3 + FSPROVIDERS__4 FsProviders = 4 + FSPROVIDERS__5 FsProviders = 5 +) + +// All allowed values of FsProviders enum +var AllowedFsProvidersEnumValues = []FsProviders{ + 0, + 1, + 2, + 3, + 4, + 5, +} + +func (v *FsProviders) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FsProviders(value) + for _, existing := range AllowedFsProvidersEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FsProviders", value) +} + +// NewFsProvidersFromValue returns a pointer to a valid FsProviders +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFsProvidersFromValue(v int32) (*FsProviders, error) { + ev := FsProviders(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FsProviders: valid values are %v", v, AllowedFsProvidersEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FsProviders) IsValid() bool { + for _, existing := range AllowedFsProvidersEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FsProviders value +func (v FsProviders) Ptr() *FsProviders { + return &v +} + +type NullableFsProviders struct { + value *FsProviders + isSet bool +} + +func (v NullableFsProviders) Get() *FsProviders { + return v.value +} + +func (v *NullableFsProviders) Set(val *FsProviders) { + v.value = val + v.isSet = true +} + +func (v NullableFsProviders) IsSet() bool { + return v.isSet +} + +func (v *NullableFsProviders) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFsProviders(val *FsProviders) *NullableFsProviders { + return &NullableFsProviders{value: val, isSet: true} +} + +func (v NullableFsProviders) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFsProviders) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_ftp_passive_port_range.go b/server/common/sftpgo/v2/openapi/model_ftp_passive_port_range.go new file mode 100644 index 00000000..ea5c9bbc --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_ftp_passive_port_range.go @@ -0,0 +1,151 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// FTPPassivePortRange struct for FTPPassivePortRange +type FTPPassivePortRange struct { + Start *int32 `json:"start,omitempty"` + End *int32 `json:"end,omitempty"` +} + +// NewFTPPassivePortRange instantiates a new FTPPassivePortRange object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFTPPassivePortRange() *FTPPassivePortRange { + this := FTPPassivePortRange{} + return &this +} + +// NewFTPPassivePortRangeWithDefaults instantiates a new FTPPassivePortRange object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFTPPassivePortRangeWithDefaults() *FTPPassivePortRange { + this := FTPPassivePortRange{} + return &this +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *FTPPassivePortRange) GetStart() int32 { + if o == nil || o.Start == nil { + var ret int32 + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FTPPassivePortRange) GetStartOk() (*int32, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *FTPPassivePortRange) HasStart() bool { + if o != nil && o.Start != nil { + return true + } + + return false +} + +// SetStart gets a reference to the given int32 and assigns it to the Start field. +func (o *FTPPassivePortRange) SetStart(v int32) { + o.Start = &v +} + +// GetEnd returns the End field value if set, zero value otherwise. +func (o *FTPPassivePortRange) GetEnd() int32 { + if o == nil || o.End == nil { + var ret int32 + return ret + } + return *o.End +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FTPPassivePortRange) GetEndOk() (*int32, bool) { + if o == nil || o.End == nil { + return nil, false + } + return o.End, true +} + +// HasEnd returns a boolean if a field has been set. +func (o *FTPPassivePortRange) HasEnd() bool { + if o != nil && o.End != nil { + return true + } + + return false +} + +// SetEnd gets a reference to the given int32 and assigns it to the End field. +func (o *FTPPassivePortRange) SetEnd(v int32) { + o.End = &v +} + +func (o FTPPassivePortRange) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Start != nil { + toSerialize["start"] = o.Start + } + if o.End != nil { + toSerialize["end"] = o.End + } + return json.Marshal(toSerialize) +} + +type NullableFTPPassivePortRange struct { + value *FTPPassivePortRange + isSet bool +} + +func (v NullableFTPPassivePortRange) Get() *FTPPassivePortRange { + return v.value +} + +func (v *NullableFTPPassivePortRange) Set(val *FTPPassivePortRange) { + v.value = val + v.isSet = true +} + +func (v NullableFTPPassivePortRange) IsSet() bool { + return v.isSet +} + +func (v *NullableFTPPassivePortRange) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFTPPassivePortRange(val *FTPPassivePortRange) *NullableFTPPassivePortRange { + return &NullableFTPPassivePortRange{value: val, isSet: true} +} + +func (v NullableFTPPassivePortRange) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFTPPassivePortRange) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_ftp_service_status.go b/server/common/sftpgo/v2/openapi/model_ftp_service_status.go new file mode 100644 index 00000000..6dd1ee23 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_ftp_service_status.go @@ -0,0 +1,188 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// FTPServiceStatus struct for FTPServiceStatus +type FTPServiceStatus struct { + IsActive *bool `json:"is_active,omitempty"` + Bindings []FTPDBinding `json:"bindings,omitempty"` + PassivePortRange *FTPPassivePortRange `json:"passive_port_range,omitempty"` +} + +// NewFTPServiceStatus instantiates a new FTPServiceStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFTPServiceStatus() *FTPServiceStatus { + this := FTPServiceStatus{} + return &this +} + +// NewFTPServiceStatusWithDefaults instantiates a new FTPServiceStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFTPServiceStatusWithDefaults() *FTPServiceStatus { + this := FTPServiceStatus{} + return &this +} + +// GetIsActive returns the IsActive field value if set, zero value otherwise. +func (o *FTPServiceStatus) GetIsActive() bool { + if o == nil || o.IsActive == nil { + var ret bool + return ret + } + return *o.IsActive +} + +// GetIsActiveOk returns a tuple with the IsActive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FTPServiceStatus) GetIsActiveOk() (*bool, bool) { + if o == nil || o.IsActive == nil { + return nil, false + } + return o.IsActive, true +} + +// HasIsActive returns a boolean if a field has been set. +func (o *FTPServiceStatus) HasIsActive() bool { + if o != nil && o.IsActive != nil { + return true + } + + return false +} + +// SetIsActive gets a reference to the given bool and assigns it to the IsActive field. +func (o *FTPServiceStatus) SetIsActive(v bool) { + o.IsActive = &v +} + +// GetBindings returns the Bindings field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FTPServiceStatus) GetBindings() []FTPDBinding { + if o == nil { + var ret []FTPDBinding + return ret + } + return o.Bindings +} + +// GetBindingsOk returns a tuple with the Bindings field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FTPServiceStatus) GetBindingsOk() ([]FTPDBinding, bool) { + if o == nil || o.Bindings == nil { + return nil, false + } + return o.Bindings, true +} + +// HasBindings returns a boolean if a field has been set. +func (o *FTPServiceStatus) HasBindings() bool { + if o != nil && o.Bindings != nil { + return true + } + + return false +} + +// SetBindings gets a reference to the given []FTPDBinding and assigns it to the Bindings field. +func (o *FTPServiceStatus) SetBindings(v []FTPDBinding) { + o.Bindings = v +} + +// GetPassivePortRange returns the PassivePortRange field value if set, zero value otherwise. +func (o *FTPServiceStatus) GetPassivePortRange() FTPPassivePortRange { + if o == nil || o.PassivePortRange == nil { + var ret FTPPassivePortRange + return ret + } + return *o.PassivePortRange +} + +// GetPassivePortRangeOk returns a tuple with the PassivePortRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FTPServiceStatus) GetPassivePortRangeOk() (*FTPPassivePortRange, bool) { + if o == nil || o.PassivePortRange == nil { + return nil, false + } + return o.PassivePortRange, true +} + +// HasPassivePortRange returns a boolean if a field has been set. +func (o *FTPServiceStatus) HasPassivePortRange() bool { + if o != nil && o.PassivePortRange != nil { + return true + } + + return false +} + +// SetPassivePortRange gets a reference to the given FTPPassivePortRange and assigns it to the PassivePortRange field. +func (o *FTPServiceStatus) SetPassivePortRange(v FTPPassivePortRange) { + o.PassivePortRange = &v +} + +func (o FTPServiceStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.IsActive != nil { + toSerialize["is_active"] = o.IsActive + } + if o.Bindings != nil { + toSerialize["bindings"] = o.Bindings + } + if o.PassivePortRange != nil { + toSerialize["passive_port_range"] = o.PassivePortRange + } + return json.Marshal(toSerialize) +} + +type NullableFTPServiceStatus struct { + value *FTPServiceStatus + isSet bool +} + +func (v NullableFTPServiceStatus) Get() *FTPServiceStatus { + return v.value +} + +func (v *NullableFTPServiceStatus) Set(val *FTPServiceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableFTPServiceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableFTPServiceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFTPServiceStatus(val *FTPServiceStatus) *NullableFTPServiceStatus { + return &NullableFTPServiceStatus{value: val, isSet: true} +} + +func (v NullableFTPServiceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFTPServiceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_ftpd_binding.go b/server/common/sftpgo/v2/openapi/model_ftpd_binding.go new file mode 100644 index 00000000..9e5fb234 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_ftpd_binding.go @@ -0,0 +1,301 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// FTPDBinding struct for FTPDBinding +type FTPDBinding struct { + // TCP address the server listen on + Address *string `json:"address,omitempty"` + // the port used for serving requests + Port *int32 `json:"port,omitempty"` + // apply the proxy configuration, if any + ApplyProxyConfig *bool `json:"apply_proxy_config,omitempty"` + // TLS mode: * `0` - clear or explicit TLS * `1` - explicit TLS required * `2` - implicit TLS + TlsMode *int32 `json:"tls_mode,omitempty"` + // External IP address to expose for passive connections + ForcePassiveIp *string `json:"force_passive_ip,omitempty"` + // 1 means that client certificate authentication is required in addition to FTP authentication + ClientAuthType *int32 `json:"client_auth_type,omitempty"` +} + +// NewFTPDBinding instantiates a new FTPDBinding object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFTPDBinding() *FTPDBinding { + this := FTPDBinding{} + return &this +} + +// NewFTPDBindingWithDefaults instantiates a new FTPDBinding object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFTPDBindingWithDefaults() *FTPDBinding { + this := FTPDBinding{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *FTPDBinding) GetAddress() string { + if o == nil || o.Address == nil { + var ret string + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FTPDBinding) GetAddressOk() (*string, bool) { + if o == nil || o.Address == nil { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *FTPDBinding) HasAddress() bool { + if o != nil && o.Address != nil { + return true + } + + return false +} + +// SetAddress gets a reference to the given string and assigns it to the Address field. +func (o *FTPDBinding) SetAddress(v string) { + o.Address = &v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *FTPDBinding) GetPort() int32 { + if o == nil || o.Port == nil { + var ret int32 + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FTPDBinding) GetPortOk() (*int32, bool) { + if o == nil || o.Port == nil { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *FTPDBinding) HasPort() bool { + if o != nil && o.Port != nil { + return true + } + + return false +} + +// SetPort gets a reference to the given int32 and assigns it to the Port field. +func (o *FTPDBinding) SetPort(v int32) { + o.Port = &v +} + +// GetApplyProxyConfig returns the ApplyProxyConfig field value if set, zero value otherwise. +func (o *FTPDBinding) GetApplyProxyConfig() bool { + if o == nil || o.ApplyProxyConfig == nil { + var ret bool + return ret + } + return *o.ApplyProxyConfig +} + +// GetApplyProxyConfigOk returns a tuple with the ApplyProxyConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FTPDBinding) GetApplyProxyConfigOk() (*bool, bool) { + if o == nil || o.ApplyProxyConfig == nil { + return nil, false + } + return o.ApplyProxyConfig, true +} + +// HasApplyProxyConfig returns a boolean if a field has been set. +func (o *FTPDBinding) HasApplyProxyConfig() bool { + if o != nil && o.ApplyProxyConfig != nil { + return true + } + + return false +} + +// SetApplyProxyConfig gets a reference to the given bool and assigns it to the ApplyProxyConfig field. +func (o *FTPDBinding) SetApplyProxyConfig(v bool) { + o.ApplyProxyConfig = &v +} + +// GetTlsMode returns the TlsMode field value if set, zero value otherwise. +func (o *FTPDBinding) GetTlsMode() int32 { + if o == nil || o.TlsMode == nil { + var ret int32 + return ret + } + return *o.TlsMode +} + +// GetTlsModeOk returns a tuple with the TlsMode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FTPDBinding) GetTlsModeOk() (*int32, bool) { + if o == nil || o.TlsMode == nil { + return nil, false + } + return o.TlsMode, true +} + +// HasTlsMode returns a boolean if a field has been set. +func (o *FTPDBinding) HasTlsMode() bool { + if o != nil && o.TlsMode != nil { + return true + } + + return false +} + +// SetTlsMode gets a reference to the given int32 and assigns it to the TlsMode field. +func (o *FTPDBinding) SetTlsMode(v int32) { + o.TlsMode = &v +} + +// GetForcePassiveIp returns the ForcePassiveIp field value if set, zero value otherwise. +func (o *FTPDBinding) GetForcePassiveIp() string { + if o == nil || o.ForcePassiveIp == nil { + var ret string + return ret + } + return *o.ForcePassiveIp +} + +// GetForcePassiveIpOk returns a tuple with the ForcePassiveIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FTPDBinding) GetForcePassiveIpOk() (*string, bool) { + if o == nil || o.ForcePassiveIp == nil { + return nil, false + } + return o.ForcePassiveIp, true +} + +// HasForcePassiveIp returns a boolean if a field has been set. +func (o *FTPDBinding) HasForcePassiveIp() bool { + if o != nil && o.ForcePassiveIp != nil { + return true + } + + return false +} + +// SetForcePassiveIp gets a reference to the given string and assigns it to the ForcePassiveIp field. +func (o *FTPDBinding) SetForcePassiveIp(v string) { + o.ForcePassiveIp = &v +} + +// GetClientAuthType returns the ClientAuthType field value if set, zero value otherwise. +func (o *FTPDBinding) GetClientAuthType() int32 { + if o == nil || o.ClientAuthType == nil { + var ret int32 + return ret + } + return *o.ClientAuthType +} + +// GetClientAuthTypeOk returns a tuple with the ClientAuthType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FTPDBinding) GetClientAuthTypeOk() (*int32, bool) { + if o == nil || o.ClientAuthType == nil { + return nil, false + } + return o.ClientAuthType, true +} + +// HasClientAuthType returns a boolean if a field has been set. +func (o *FTPDBinding) HasClientAuthType() bool { + if o != nil && o.ClientAuthType != nil { + return true + } + + return false +} + +// SetClientAuthType gets a reference to the given int32 and assigns it to the ClientAuthType field. +func (o *FTPDBinding) SetClientAuthType(v int32) { + o.ClientAuthType = &v +} + +func (o FTPDBinding) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Address != nil { + toSerialize["address"] = o.Address + } + if o.Port != nil { + toSerialize["port"] = o.Port + } + if o.ApplyProxyConfig != nil { + toSerialize["apply_proxy_config"] = o.ApplyProxyConfig + } + if o.TlsMode != nil { + toSerialize["tls_mode"] = o.TlsMode + } + if o.ForcePassiveIp != nil { + toSerialize["force_passive_ip"] = o.ForcePassiveIp + } + if o.ClientAuthType != nil { + toSerialize["client_auth_type"] = o.ClientAuthType + } + return json.Marshal(toSerialize) +} + +type NullableFTPDBinding struct { + value *FTPDBinding + isSet bool +} + +func (v NullableFTPDBinding) Get() *FTPDBinding { + return v.value +} + +func (v *NullableFTPDBinding) Set(val *FTPDBinding) { + v.value = val + v.isSet = true +} + +func (v NullableFTPDBinding) IsSet() bool { + return v.isSet +} + +func (v *NullableFTPDBinding) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFTPDBinding(val *FTPDBinding) *NullableFTPDBinding { + return &NullableFTPDBinding{value: val, isSet: true} +} + +func (v NullableFTPDBinding) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFTPDBinding) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_gcs_config.go b/server/common/sftpgo/v2/openapi/model_gcs_config.go new file mode 100644 index 00000000..fb725f9e --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_gcs_config.go @@ -0,0 +1,298 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// GCSConfig Google Cloud Storage configuration details. The \"credentials\" field must be populated only when adding/updating a user. It will be always omitted, since there are sensitive data, when you search/get users +type GCSConfig struct { + Bucket *string `json:"bucket,omitempty"` + Credentials *Secret `json:"credentials,omitempty"` + // Automatic credentials: * `0` - disabled, explicit credentials, using a JSON credentials file, must be provided. This is the default value if the field is null * `1` - enabled, we try to use the Application Default Credentials (ADC) strategy to find your application's credentials + AutomaticCredentials *int32 `json:"automatic_credentials,omitempty"` + StorageClass *string `json:"storage_class,omitempty"` + // The ACL to apply to uploaded objects. Leave empty to use the default ACL. For more information and available ACLs, refer to the JSON API here: https://cloud.google.com/storage/docs/access-control/lists#predefined-acl + Acl *string `json:"acl,omitempty"` + // key_prefix is similar to a chroot directory for a local filesystem. If specified the user will only see contents that starts with this prefix and so you can restrict access to a specific virtual folder. The prefix, if not empty, must not start with \"/\" and must end with \"/\". If empty the whole bucket contents will be available + KeyPrefix *string `json:"key_prefix,omitempty"` +} + +// NewGCSConfig instantiates a new GCSConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGCSConfig() *GCSConfig { + this := GCSConfig{} + return &this +} + +// NewGCSConfigWithDefaults instantiates a new GCSConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGCSConfigWithDefaults() *GCSConfig { + this := GCSConfig{} + return &this +} + +// GetBucket returns the Bucket field value if set, zero value otherwise. +func (o *GCSConfig) GetBucket() string { + if o == nil || o.Bucket == nil { + var ret string + return ret + } + return *o.Bucket +} + +// GetBucketOk returns a tuple with the Bucket field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCSConfig) GetBucketOk() (*string, bool) { + if o == nil || o.Bucket == nil { + return nil, false + } + return o.Bucket, true +} + +// HasBucket returns a boolean if a field has been set. +func (o *GCSConfig) HasBucket() bool { + if o != nil && o.Bucket != nil { + return true + } + + return false +} + +// SetBucket gets a reference to the given string and assigns it to the Bucket field. +func (o *GCSConfig) SetBucket(v string) { + o.Bucket = &v +} + +// GetCredentials returns the Credentials field value if set, zero value otherwise. +func (o *GCSConfig) GetCredentials() Secret { + if o == nil || o.Credentials == nil { + var ret Secret + return ret + } + return *o.Credentials +} + +// GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCSConfig) GetCredentialsOk() (*Secret, bool) { + if o == nil || o.Credentials == nil { + return nil, false + } + return o.Credentials, true +} + +// HasCredentials returns a boolean if a field has been set. +func (o *GCSConfig) HasCredentials() bool { + if o != nil && o.Credentials != nil { + return true + } + + return false +} + +// SetCredentials gets a reference to the given Secret and assigns it to the Credentials field. +func (o *GCSConfig) SetCredentials(v Secret) { + o.Credentials = &v +} + +// GetAutomaticCredentials returns the AutomaticCredentials field value if set, zero value otherwise. +func (o *GCSConfig) GetAutomaticCredentials() int32 { + if o == nil || o.AutomaticCredentials == nil { + var ret int32 + return ret + } + return *o.AutomaticCredentials +} + +// GetAutomaticCredentialsOk returns a tuple with the AutomaticCredentials field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCSConfig) GetAutomaticCredentialsOk() (*int32, bool) { + if o == nil || o.AutomaticCredentials == nil { + return nil, false + } + return o.AutomaticCredentials, true +} + +// HasAutomaticCredentials returns a boolean if a field has been set. +func (o *GCSConfig) HasAutomaticCredentials() bool { + if o != nil && o.AutomaticCredentials != nil { + return true + } + + return false +} + +// SetAutomaticCredentials gets a reference to the given int32 and assigns it to the AutomaticCredentials field. +func (o *GCSConfig) SetAutomaticCredentials(v int32) { + o.AutomaticCredentials = &v +} + +// GetStorageClass returns the StorageClass field value if set, zero value otherwise. +func (o *GCSConfig) GetStorageClass() string { + if o == nil || o.StorageClass == nil { + var ret string + return ret + } + return *o.StorageClass +} + +// GetStorageClassOk returns a tuple with the StorageClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCSConfig) GetStorageClassOk() (*string, bool) { + if o == nil || o.StorageClass == nil { + return nil, false + } + return o.StorageClass, true +} + +// HasStorageClass returns a boolean if a field has been set. +func (o *GCSConfig) HasStorageClass() bool { + if o != nil && o.StorageClass != nil { + return true + } + + return false +} + +// SetStorageClass gets a reference to the given string and assigns it to the StorageClass field. +func (o *GCSConfig) SetStorageClass(v string) { + o.StorageClass = &v +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *GCSConfig) GetAcl() string { + if o == nil || o.Acl == nil { + var ret string + return ret + } + return *o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCSConfig) GetAclOk() (*string, bool) { + if o == nil || o.Acl == nil { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *GCSConfig) HasAcl() bool { + if o != nil && o.Acl != nil { + return true + } + + return false +} + +// SetAcl gets a reference to the given string and assigns it to the Acl field. +func (o *GCSConfig) SetAcl(v string) { + o.Acl = &v +} + +// GetKeyPrefix returns the KeyPrefix field value if set, zero value otherwise. +func (o *GCSConfig) GetKeyPrefix() string { + if o == nil || o.KeyPrefix == nil { + var ret string + return ret + } + return *o.KeyPrefix +} + +// GetKeyPrefixOk returns a tuple with the KeyPrefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCSConfig) GetKeyPrefixOk() (*string, bool) { + if o == nil || o.KeyPrefix == nil { + return nil, false + } + return o.KeyPrefix, true +} + +// HasKeyPrefix returns a boolean if a field has been set. +func (o *GCSConfig) HasKeyPrefix() bool { + if o != nil && o.KeyPrefix != nil { + return true + } + + return false +} + +// SetKeyPrefix gets a reference to the given string and assigns it to the KeyPrefix field. +func (o *GCSConfig) SetKeyPrefix(v string) { + o.KeyPrefix = &v +} + +func (o GCSConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Bucket != nil { + toSerialize["bucket"] = o.Bucket + } + if o.Credentials != nil { + toSerialize["credentials"] = o.Credentials + } + if o.AutomaticCredentials != nil { + toSerialize["automatic_credentials"] = o.AutomaticCredentials + } + if o.StorageClass != nil { + toSerialize["storage_class"] = o.StorageClass + } + if o.Acl != nil { + toSerialize["acl"] = o.Acl + } + if o.KeyPrefix != nil { + toSerialize["key_prefix"] = o.KeyPrefix + } + return json.Marshal(toSerialize) +} + +type NullableGCSConfig struct { + value *GCSConfig + isSet bool +} + +func (v NullableGCSConfig) Get() *GCSConfig { + return v.value +} + +func (v *NullableGCSConfig) Set(val *GCSConfig) { + v.value = val + v.isSet = true +} + +func (v NullableGCSConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableGCSConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGCSConfig(val *GCSConfig) *NullableGCSConfig { + return &NullableGCSConfig{value: val, isSet: true} +} + +func (v NullableGCSConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGCSConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_hooks_filter.go b/server/common/sftpgo/v2/openapi/model_hooks_filter.go new file mode 100644 index 00000000..43c064ca --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_hooks_filter.go @@ -0,0 +1,190 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// HooksFilter User specific hook overrides +type HooksFilter struct { + // If true, the external auth hook, if defined, will not be executed + ExternalAuthDisabled *bool `json:"external_auth_disabled,omitempty"` + // If true, the pre-login hook, if defined, will not be executed + PreLoginDisabled *bool `json:"pre_login_disabled,omitempty"` + // If true, the check password hook, if defined, will not be executed + CheckPasswordDisabled *bool `json:"check_password_disabled,omitempty"` +} + +// NewHooksFilter instantiates a new HooksFilter object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewHooksFilter() *HooksFilter { + this := HooksFilter{} + return &this +} + +// NewHooksFilterWithDefaults instantiates a new HooksFilter object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewHooksFilterWithDefaults() *HooksFilter { + this := HooksFilter{} + return &this +} + +// GetExternalAuthDisabled returns the ExternalAuthDisabled field value if set, zero value otherwise. +func (o *HooksFilter) GetExternalAuthDisabled() bool { + if o == nil || o.ExternalAuthDisabled == nil { + var ret bool + return ret + } + return *o.ExternalAuthDisabled +} + +// GetExternalAuthDisabledOk returns a tuple with the ExternalAuthDisabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HooksFilter) GetExternalAuthDisabledOk() (*bool, bool) { + if o == nil || o.ExternalAuthDisabled == nil { + return nil, false + } + return o.ExternalAuthDisabled, true +} + +// HasExternalAuthDisabled returns a boolean if a field has been set. +func (o *HooksFilter) HasExternalAuthDisabled() bool { + if o != nil && o.ExternalAuthDisabled != nil { + return true + } + + return false +} + +// SetExternalAuthDisabled gets a reference to the given bool and assigns it to the ExternalAuthDisabled field. +func (o *HooksFilter) SetExternalAuthDisabled(v bool) { + o.ExternalAuthDisabled = &v +} + +// GetPreLoginDisabled returns the PreLoginDisabled field value if set, zero value otherwise. +func (o *HooksFilter) GetPreLoginDisabled() bool { + if o == nil || o.PreLoginDisabled == nil { + var ret bool + return ret + } + return *o.PreLoginDisabled +} + +// GetPreLoginDisabledOk returns a tuple with the PreLoginDisabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HooksFilter) GetPreLoginDisabledOk() (*bool, bool) { + if o == nil || o.PreLoginDisabled == nil { + return nil, false + } + return o.PreLoginDisabled, true +} + +// HasPreLoginDisabled returns a boolean if a field has been set. +func (o *HooksFilter) HasPreLoginDisabled() bool { + if o != nil && o.PreLoginDisabled != nil { + return true + } + + return false +} + +// SetPreLoginDisabled gets a reference to the given bool and assigns it to the PreLoginDisabled field. +func (o *HooksFilter) SetPreLoginDisabled(v bool) { + o.PreLoginDisabled = &v +} + +// GetCheckPasswordDisabled returns the CheckPasswordDisabled field value if set, zero value otherwise. +func (o *HooksFilter) GetCheckPasswordDisabled() bool { + if o == nil || o.CheckPasswordDisabled == nil { + var ret bool + return ret + } + return *o.CheckPasswordDisabled +} + +// GetCheckPasswordDisabledOk returns a tuple with the CheckPasswordDisabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HooksFilter) GetCheckPasswordDisabledOk() (*bool, bool) { + if o == nil || o.CheckPasswordDisabled == nil { + return nil, false + } + return o.CheckPasswordDisabled, true +} + +// HasCheckPasswordDisabled returns a boolean if a field has been set. +func (o *HooksFilter) HasCheckPasswordDisabled() bool { + if o != nil && o.CheckPasswordDisabled != nil { + return true + } + + return false +} + +// SetCheckPasswordDisabled gets a reference to the given bool and assigns it to the CheckPasswordDisabled field. +func (o *HooksFilter) SetCheckPasswordDisabled(v bool) { + o.CheckPasswordDisabled = &v +} + +func (o HooksFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ExternalAuthDisabled != nil { + toSerialize["external_auth_disabled"] = o.ExternalAuthDisabled + } + if o.PreLoginDisabled != nil { + toSerialize["pre_login_disabled"] = o.PreLoginDisabled + } + if o.CheckPasswordDisabled != nil { + toSerialize["check_password_disabled"] = o.CheckPasswordDisabled + } + return json.Marshal(toSerialize) +} + +type NullableHooksFilter struct { + value *HooksFilter + isSet bool +} + +func (v NullableHooksFilter) Get() *HooksFilter { + return v.value +} + +func (v *NullableHooksFilter) Set(val *HooksFilter) { + v.value = val + v.isSet = true +} + +func (v NullableHooksFilter) IsSet() bool { + return v.isSet +} + +func (v *NullableHooksFilter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHooksFilter(val *HooksFilter) *NullableHooksFilter { + return &NullableHooksFilter{value: val, isSet: true} +} + +func (v NullableHooksFilter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHooksFilter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_inline_object_1.go b/server/common/sftpgo/v2/openapi/model_inline_object_1.go new file mode 100644 index 00000000..800d8629 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_inline_object_1.go @@ -0,0 +1,116 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// InlineObject1 struct for InlineObject1 +type InlineObject1 struct { + // name of the configuration to use to generate the secret + ConfigName *string `json:"config_name,omitempty"` +} + +// NewInlineObject1 instantiates a new InlineObject1 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInlineObject1() *InlineObject1 { + this := InlineObject1{} + return &this +} + +// NewInlineObject1WithDefaults instantiates a new InlineObject1 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInlineObject1WithDefaults() *InlineObject1 { + this := InlineObject1{} + return &this +} + +// GetConfigName returns the ConfigName field value if set, zero value otherwise. +func (o *InlineObject1) GetConfigName() string { + if o == nil || o.ConfigName == nil { + var ret string + return ret + } + return *o.ConfigName +} + +// GetConfigNameOk returns a tuple with the ConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject1) GetConfigNameOk() (*string, bool) { + if o == nil || o.ConfigName == nil { + return nil, false + } + return o.ConfigName, true +} + +// HasConfigName returns a boolean if a field has been set. +func (o *InlineObject1) HasConfigName() bool { + if o != nil && o.ConfigName != nil { + return true + } + + return false +} + +// SetConfigName gets a reference to the given string and assigns it to the ConfigName field. +func (o *InlineObject1) SetConfigName(v string) { + o.ConfigName = &v +} + +func (o InlineObject1) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ConfigName != nil { + toSerialize["config_name"] = o.ConfigName + } + return json.Marshal(toSerialize) +} + +type NullableInlineObject1 struct { + value *InlineObject1 + isSet bool +} + +func (v NullableInlineObject1) Get() *InlineObject1 { + return v.value +} + +func (v *NullableInlineObject1) Set(val *InlineObject1) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject1) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject1(val *InlineObject1) *NullableInlineObject1 { + return &NullableInlineObject1{value: val, isSet: true} +} + +func (v NullableInlineObject1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_inline_object_2.go b/server/common/sftpgo/v2/openapi/model_inline_object_2.go new file mode 100644 index 00000000..2550eeba --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_inline_object_2.go @@ -0,0 +1,190 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// InlineObject2 struct for InlineObject2 +type InlineObject2 struct { + // name of the configuration to use to validate the passcode + ConfigName *string `json:"config_name,omitempty"` + // passcode to validate + Passcode *string `json:"passcode,omitempty"` + // secret to use to validate the passcode + Secret *string `json:"secret,omitempty"` +} + +// NewInlineObject2 instantiates a new InlineObject2 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInlineObject2() *InlineObject2 { + this := InlineObject2{} + return &this +} + +// NewInlineObject2WithDefaults instantiates a new InlineObject2 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInlineObject2WithDefaults() *InlineObject2 { + this := InlineObject2{} + return &this +} + +// GetConfigName returns the ConfigName field value if set, zero value otherwise. +func (o *InlineObject2) GetConfigName() string { + if o == nil || o.ConfigName == nil { + var ret string + return ret + } + return *o.ConfigName +} + +// GetConfigNameOk returns a tuple with the ConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject2) GetConfigNameOk() (*string, bool) { + if o == nil || o.ConfigName == nil { + return nil, false + } + return o.ConfigName, true +} + +// HasConfigName returns a boolean if a field has been set. +func (o *InlineObject2) HasConfigName() bool { + if o != nil && o.ConfigName != nil { + return true + } + + return false +} + +// SetConfigName gets a reference to the given string and assigns it to the ConfigName field. +func (o *InlineObject2) SetConfigName(v string) { + o.ConfigName = &v +} + +// GetPasscode returns the Passcode field value if set, zero value otherwise. +func (o *InlineObject2) GetPasscode() string { + if o == nil || o.Passcode == nil { + var ret string + return ret + } + return *o.Passcode +} + +// GetPasscodeOk returns a tuple with the Passcode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject2) GetPasscodeOk() (*string, bool) { + if o == nil || o.Passcode == nil { + return nil, false + } + return o.Passcode, true +} + +// HasPasscode returns a boolean if a field has been set. +func (o *InlineObject2) HasPasscode() bool { + if o != nil && o.Passcode != nil { + return true + } + + return false +} + +// SetPasscode gets a reference to the given string and assigns it to the Passcode field. +func (o *InlineObject2) SetPasscode(v string) { + o.Passcode = &v +} + +// GetSecret returns the Secret field value if set, zero value otherwise. +func (o *InlineObject2) GetSecret() string { + if o == nil || o.Secret == nil { + var ret string + return ret + } + return *o.Secret +} + +// GetSecretOk returns a tuple with the Secret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject2) GetSecretOk() (*string, bool) { + if o == nil || o.Secret == nil { + return nil, false + } + return o.Secret, true +} + +// HasSecret returns a boolean if a field has been set. +func (o *InlineObject2) HasSecret() bool { + if o != nil && o.Secret != nil { + return true + } + + return false +} + +// SetSecret gets a reference to the given string and assigns it to the Secret field. +func (o *InlineObject2) SetSecret(v string) { + o.Secret = &v +} + +func (o InlineObject2) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ConfigName != nil { + toSerialize["config_name"] = o.ConfigName + } + if o.Passcode != nil { + toSerialize["passcode"] = o.Passcode + } + if o.Secret != nil { + toSerialize["secret"] = o.Secret + } + return json.Marshal(toSerialize) +} + +type NullableInlineObject2 struct { + value *InlineObject2 + isSet bool +} + +func (v NullableInlineObject2) Get() *InlineObject2 { + return v.value +} + +func (v *NullableInlineObject2) Set(val *InlineObject2) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject2) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject2) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject2(val *InlineObject2) *NullableInlineObject2 { + return &NullableInlineObject2{value: val, isSet: true} +} + +func (v NullableInlineObject2) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject2) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_inline_object_3.go b/server/common/sftpgo/v2/openapi/model_inline_object_3.go new file mode 100644 index 00000000..3f006054 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_inline_object_3.go @@ -0,0 +1,116 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// InlineObject3 struct for InlineObject3 +type InlineObject3 struct { + // IPv4/IPv6 address to remove + Ip *string `json:"ip,omitempty"` +} + +// NewInlineObject3 instantiates a new InlineObject3 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInlineObject3() *InlineObject3 { + this := InlineObject3{} + return &this +} + +// NewInlineObject3WithDefaults instantiates a new InlineObject3 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInlineObject3WithDefaults() *InlineObject3 { + this := InlineObject3{} + return &this +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *InlineObject3) GetIp() string { + if o == nil || o.Ip == nil { + var ret string + return ret + } + return *o.Ip +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetIpOk() (*string, bool) { + if o == nil || o.Ip == nil { + return nil, false + } + return o.Ip, true +} + +// HasIp returns a boolean if a field has been set. +func (o *InlineObject3) HasIp() bool { + if o != nil && o.Ip != nil { + return true + } + + return false +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *InlineObject3) SetIp(v string) { + o.Ip = &v +} + +func (o InlineObject3) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Ip != nil { + toSerialize["ip"] = o.Ip + } + return json.Marshal(toSerialize) +} + +type NullableInlineObject3 struct { + value *InlineObject3 + isSet bool +} + +func (v NullableInlineObject3) Get() *InlineObject3 { + return v.value +} + +func (v *NullableInlineObject3) Set(val *InlineObject3) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject3) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject3) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject3(val *InlineObject3) *NullableInlineObject3 { + return &NullableInlineObject3{value: val, isSet: true} +} + +func (v NullableInlineObject3) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject3) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_inline_object_4.go b/server/common/sftpgo/v2/openapi/model_inline_object_4.go new file mode 100644 index 00000000..8e115a95 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_inline_object_4.go @@ -0,0 +1,151 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// InlineObject4 struct for InlineObject4 +type InlineObject4 struct { + Code *string `json:"code,omitempty"` + Password *string `json:"password,omitempty"` +} + +// NewInlineObject4 instantiates a new InlineObject4 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInlineObject4() *InlineObject4 { + this := InlineObject4{} + return &this +} + +// NewInlineObject4WithDefaults instantiates a new InlineObject4 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInlineObject4WithDefaults() *InlineObject4 { + this := InlineObject4{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *InlineObject4) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject4) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *InlineObject4) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *InlineObject4) SetCode(v string) { + o.Code = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *InlineObject4) GetPassword() string { + if o == nil || o.Password == nil { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject4) GetPasswordOk() (*string, bool) { + if o == nil || o.Password == nil { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *InlineObject4) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *InlineObject4) SetPassword(v string) { + o.Password = &v +} + +func (o InlineObject4) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Password != nil { + toSerialize["password"] = o.Password + } + return json.Marshal(toSerialize) +} + +type NullableInlineObject4 struct { + value *InlineObject4 + isSet bool +} + +func (v NullableInlineObject4) Get() *InlineObject4 { + return v.value +} + +func (v *NullableInlineObject4) Set(val *InlineObject4) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject4) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject4(val *InlineObject4) *NullableInlineObject4 { + return &NullableInlineObject4{value: val, isSet: true} +} + +func (v NullableInlineObject4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_inline_object_5.go b/server/common/sftpgo/v2/openapi/model_inline_object_5.go new file mode 100644 index 00000000..9bebb101 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_inline_object_5.go @@ -0,0 +1,151 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// InlineObject5 struct for InlineObject5 +type InlineObject5 struct { + Code *string `json:"code,omitempty"` + Password *string `json:"password,omitempty"` +} + +// NewInlineObject5 instantiates a new InlineObject5 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInlineObject5() *InlineObject5 { + this := InlineObject5{} + return &this +} + +// NewInlineObject5WithDefaults instantiates a new InlineObject5 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInlineObject5WithDefaults() *InlineObject5 { + this := InlineObject5{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *InlineObject5) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject5) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *InlineObject5) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *InlineObject5) SetCode(v string) { + o.Code = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *InlineObject5) GetPassword() string { + if o == nil || o.Password == nil { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject5) GetPasswordOk() (*string, bool) { + if o == nil || o.Password == nil { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *InlineObject5) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *InlineObject5) SetPassword(v string) { + o.Password = &v +} + +func (o InlineObject5) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Password != nil { + toSerialize["password"] = o.Password + } + return json.Marshal(toSerialize) +} + +type NullableInlineObject5 struct { + value *InlineObject5 + isSet bool +} + +func (v NullableInlineObject5) Get() *InlineObject5 { + return v.value +} + +func (v *NullableInlineObject5) Set(val *InlineObject5) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject5) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject5) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject5(val *InlineObject5) *NullableInlineObject5 { + return &NullableInlineObject5{value: val, isSet: true} +} + +func (v NullableInlineObject5) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject5) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_inline_object_6.go b/server/common/sftpgo/v2/openapi/model_inline_object_6.go new file mode 100644 index 00000000..45a6c9f2 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_inline_object_6.go @@ -0,0 +1,116 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// InlineObject6 struct for InlineObject6 +type InlineObject6 struct { + // name of the configuration to use to generate the secret + ConfigName *string `json:"config_name,omitempty"` +} + +// NewInlineObject6 instantiates a new InlineObject6 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInlineObject6() *InlineObject6 { + this := InlineObject6{} + return &this +} + +// NewInlineObject6WithDefaults instantiates a new InlineObject6 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInlineObject6WithDefaults() *InlineObject6 { + this := InlineObject6{} + return &this +} + +// GetConfigName returns the ConfigName field value if set, zero value otherwise. +func (o *InlineObject6) GetConfigName() string { + if o == nil || o.ConfigName == nil { + var ret string + return ret + } + return *o.ConfigName +} + +// GetConfigNameOk returns a tuple with the ConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject6) GetConfigNameOk() (*string, bool) { + if o == nil || o.ConfigName == nil { + return nil, false + } + return o.ConfigName, true +} + +// HasConfigName returns a boolean if a field has been set. +func (o *InlineObject6) HasConfigName() bool { + if o != nil && o.ConfigName != nil { + return true + } + + return false +} + +// SetConfigName gets a reference to the given string and assigns it to the ConfigName field. +func (o *InlineObject6) SetConfigName(v string) { + o.ConfigName = &v +} + +func (o InlineObject6) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ConfigName != nil { + toSerialize["config_name"] = o.ConfigName + } + return json.Marshal(toSerialize) +} + +type NullableInlineObject6 struct { + value *InlineObject6 + isSet bool +} + +func (v NullableInlineObject6) Get() *InlineObject6 { + return v.value +} + +func (v *NullableInlineObject6) Set(val *InlineObject6) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject6) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject6(val *InlineObject6) *NullableInlineObject6 { + return &NullableInlineObject6{value: val, isSet: true} +} + +func (v NullableInlineObject6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_inline_object_7.go b/server/common/sftpgo/v2/openapi/model_inline_object_7.go new file mode 100644 index 00000000..47ebd45e --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_inline_object_7.go @@ -0,0 +1,190 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// InlineObject7 struct for InlineObject7 +type InlineObject7 struct { + // name of the configuration to use to validate the passcode + ConfigName *string `json:"config_name,omitempty"` + // passcode to validate + Passcode *string `json:"passcode,omitempty"` + // secret to use to validate the passcode + Secret *string `json:"secret,omitempty"` +} + +// NewInlineObject7 instantiates a new InlineObject7 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInlineObject7() *InlineObject7 { + this := InlineObject7{} + return &this +} + +// NewInlineObject7WithDefaults instantiates a new InlineObject7 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInlineObject7WithDefaults() *InlineObject7 { + this := InlineObject7{} + return &this +} + +// GetConfigName returns the ConfigName field value if set, zero value otherwise. +func (o *InlineObject7) GetConfigName() string { + if o == nil || o.ConfigName == nil { + var ret string + return ret + } + return *o.ConfigName +} + +// GetConfigNameOk returns a tuple with the ConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject7) GetConfigNameOk() (*string, bool) { + if o == nil || o.ConfigName == nil { + return nil, false + } + return o.ConfigName, true +} + +// HasConfigName returns a boolean if a field has been set. +func (o *InlineObject7) HasConfigName() bool { + if o != nil && o.ConfigName != nil { + return true + } + + return false +} + +// SetConfigName gets a reference to the given string and assigns it to the ConfigName field. +func (o *InlineObject7) SetConfigName(v string) { + o.ConfigName = &v +} + +// GetPasscode returns the Passcode field value if set, zero value otherwise. +func (o *InlineObject7) GetPasscode() string { + if o == nil || o.Passcode == nil { + var ret string + return ret + } + return *o.Passcode +} + +// GetPasscodeOk returns a tuple with the Passcode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject7) GetPasscodeOk() (*string, bool) { + if o == nil || o.Passcode == nil { + return nil, false + } + return o.Passcode, true +} + +// HasPasscode returns a boolean if a field has been set. +func (o *InlineObject7) HasPasscode() bool { + if o != nil && o.Passcode != nil { + return true + } + + return false +} + +// SetPasscode gets a reference to the given string and assigns it to the Passcode field. +func (o *InlineObject7) SetPasscode(v string) { + o.Passcode = &v +} + +// GetSecret returns the Secret field value if set, zero value otherwise. +func (o *InlineObject7) GetSecret() string { + if o == nil || o.Secret == nil { + var ret string + return ret + } + return *o.Secret +} + +// GetSecretOk returns a tuple with the Secret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject7) GetSecretOk() (*string, bool) { + if o == nil || o.Secret == nil { + return nil, false + } + return o.Secret, true +} + +// HasSecret returns a boolean if a field has been set. +func (o *InlineObject7) HasSecret() bool { + if o != nil && o.Secret != nil { + return true + } + + return false +} + +// SetSecret gets a reference to the given string and assigns it to the Secret field. +func (o *InlineObject7) SetSecret(v string) { + o.Secret = &v +} + +func (o InlineObject7) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ConfigName != nil { + toSerialize["config_name"] = o.ConfigName + } + if o.Passcode != nil { + toSerialize["passcode"] = o.Passcode + } + if o.Secret != nil { + toSerialize["secret"] = o.Secret + } + return json.Marshal(toSerialize) +} + +type NullableInlineObject7 struct { + value *InlineObject7 + isSet bool +} + +func (v NullableInlineObject7) Get() *InlineObject7 { + return v.value +} + +func (v *NullableInlineObject7) Set(val *InlineObject7) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject7) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject7) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject7(val *InlineObject7) *NullableInlineObject7 { + return &NullableInlineObject7{value: val, isSet: true} +} + +func (v NullableInlineObject7) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject7) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_inline_object_9.go b/server/common/sftpgo/v2/openapi/model_inline_object_9.go new file mode 100644 index 00000000..280b34c5 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_inline_object_9.go @@ -0,0 +1,116 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// InlineObject9 struct for InlineObject9 +type InlineObject9 struct { + // File modification time as unix timestamp in milliseconds + ModificationTime *int32 `json:"modification_time,omitempty"` +} + +// NewInlineObject9 instantiates a new InlineObject9 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInlineObject9() *InlineObject9 { + this := InlineObject9{} + return &this +} + +// NewInlineObject9WithDefaults instantiates a new InlineObject9 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInlineObject9WithDefaults() *InlineObject9 { + this := InlineObject9{} + return &this +} + +// GetModificationTime returns the ModificationTime field value if set, zero value otherwise. +func (o *InlineObject9) GetModificationTime() int32 { + if o == nil || o.ModificationTime == nil { + var ret int32 + return ret + } + return *o.ModificationTime +} + +// GetModificationTimeOk returns a tuple with the ModificationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject9) GetModificationTimeOk() (*int32, bool) { + if o == nil || o.ModificationTime == nil { + return nil, false + } + return o.ModificationTime, true +} + +// HasModificationTime returns a boolean if a field has been set. +func (o *InlineObject9) HasModificationTime() bool { + if o != nil && o.ModificationTime != nil { + return true + } + + return false +} + +// SetModificationTime gets a reference to the given int32 and assigns it to the ModificationTime field. +func (o *InlineObject9) SetModificationTime(v int32) { + o.ModificationTime = &v +} + +func (o InlineObject9) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ModificationTime != nil { + toSerialize["modification_time"] = o.ModificationTime + } + return json.Marshal(toSerialize) +} + +type NullableInlineObject9 struct { + value *InlineObject9 + isSet bool +} + +func (v NullableInlineObject9) Get() *InlineObject9 { + return v.value +} + +func (v *NullableInlineObject9) Set(val *InlineObject9) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject9) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject9) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject9(val *InlineObject9) *NullableInlineObject9 { + return &NullableInlineObject9{value: val, isSet: true} +} + +func (v NullableInlineObject9) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject9) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_inline_response_200.go b/server/common/sftpgo/v2/openapi/model_inline_response_200.go new file mode 100644 index 00000000..2fde404f --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_inline_response_200.go @@ -0,0 +1,224 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// InlineResponse200 struct for InlineResponse200 +type InlineResponse200 struct { + ConfigName *string `json:"config_name,omitempty"` + Issuer *string `json:"issuer,omitempty"` + Secret *string `json:"secret,omitempty"` + // QR code png encoded as BASE64 + QrCode *string `json:"qr_code,omitempty"` +} + +// NewInlineResponse200 instantiates a new InlineResponse200 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInlineResponse200() *InlineResponse200 { + this := InlineResponse200{} + return &this +} + +// NewInlineResponse200WithDefaults instantiates a new InlineResponse200 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInlineResponse200WithDefaults() *InlineResponse200 { + this := InlineResponse200{} + return &this +} + +// GetConfigName returns the ConfigName field value if set, zero value otherwise. +func (o *InlineResponse200) GetConfigName() string { + if o == nil || o.ConfigName == nil { + var ret string + return ret + } + return *o.ConfigName +} + +// GetConfigNameOk returns a tuple with the ConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineResponse200) GetConfigNameOk() (*string, bool) { + if o == nil || o.ConfigName == nil { + return nil, false + } + return o.ConfigName, true +} + +// HasConfigName returns a boolean if a field has been set. +func (o *InlineResponse200) HasConfigName() bool { + if o != nil && o.ConfigName != nil { + return true + } + + return false +} + +// SetConfigName gets a reference to the given string and assigns it to the ConfigName field. +func (o *InlineResponse200) SetConfigName(v string) { + o.ConfigName = &v +} + +// GetIssuer returns the Issuer field value if set, zero value otherwise. +func (o *InlineResponse200) GetIssuer() string { + if o == nil || o.Issuer == nil { + var ret string + return ret + } + return *o.Issuer +} + +// GetIssuerOk returns a tuple with the Issuer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineResponse200) GetIssuerOk() (*string, bool) { + if o == nil || o.Issuer == nil { + return nil, false + } + return o.Issuer, true +} + +// HasIssuer returns a boolean if a field has been set. +func (o *InlineResponse200) HasIssuer() bool { + if o != nil && o.Issuer != nil { + return true + } + + return false +} + +// SetIssuer gets a reference to the given string and assigns it to the Issuer field. +func (o *InlineResponse200) SetIssuer(v string) { + o.Issuer = &v +} + +// GetSecret returns the Secret field value if set, zero value otherwise. +func (o *InlineResponse200) GetSecret() string { + if o == nil || o.Secret == nil { + var ret string + return ret + } + return *o.Secret +} + +// GetSecretOk returns a tuple with the Secret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineResponse200) GetSecretOk() (*string, bool) { + if o == nil || o.Secret == nil { + return nil, false + } + return o.Secret, true +} + +// HasSecret returns a boolean if a field has been set. +func (o *InlineResponse200) HasSecret() bool { + if o != nil && o.Secret != nil { + return true + } + + return false +} + +// SetSecret gets a reference to the given string and assigns it to the Secret field. +func (o *InlineResponse200) SetSecret(v string) { + o.Secret = &v +} + +// GetQrCode returns the QrCode field value if set, zero value otherwise. +func (o *InlineResponse200) GetQrCode() string { + if o == nil || o.QrCode == nil { + var ret string + return ret + } + return *o.QrCode +} + +// GetQrCodeOk returns a tuple with the QrCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineResponse200) GetQrCodeOk() (*string, bool) { + if o == nil || o.QrCode == nil { + return nil, false + } + return o.QrCode, true +} + +// HasQrCode returns a boolean if a field has been set. +func (o *InlineResponse200) HasQrCode() bool { + if o != nil && o.QrCode != nil { + return true + } + + return false +} + +// SetQrCode gets a reference to the given string and assigns it to the QrCode field. +func (o *InlineResponse200) SetQrCode(v string) { + o.QrCode = &v +} + +func (o InlineResponse200) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ConfigName != nil { + toSerialize["config_name"] = o.ConfigName + } + if o.Issuer != nil { + toSerialize["issuer"] = o.Issuer + } + if o.Secret != nil { + toSerialize["secret"] = o.Secret + } + if o.QrCode != nil { + toSerialize["qr_code"] = o.QrCode + } + return json.Marshal(toSerialize) +} + +type NullableInlineResponse200 struct { + value *InlineResponse200 + isSet bool +} + +func (v NullableInlineResponse200) Get() *InlineResponse200 { + return v.value +} + +func (v *NullableInlineResponse200) Set(val *InlineResponse200) { + v.value = val + v.isSet = true +} + +func (v NullableInlineResponse200) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineResponse200) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineResponse200(val *InlineResponse200) *NullableInlineResponse200 { + return &NullableInlineResponse200{value: val, isSet: true} +} + +func (v NullableInlineResponse200) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineResponse200) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_inline_response_201.go b/server/common/sftpgo/v2/openapi/model_inline_response_201.go new file mode 100644 index 00000000..53c431ed --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_inline_response_201.go @@ -0,0 +1,152 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// InlineResponse201 struct for InlineResponse201 +type InlineResponse201 struct { + Mesage *string `json:"mesage,omitempty"` + // generated API key + Key *string `json:"key,omitempty"` +} + +// NewInlineResponse201 instantiates a new InlineResponse201 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInlineResponse201() *InlineResponse201 { + this := InlineResponse201{} + return &this +} + +// NewInlineResponse201WithDefaults instantiates a new InlineResponse201 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInlineResponse201WithDefaults() *InlineResponse201 { + this := InlineResponse201{} + return &this +} + +// GetMesage returns the Mesage field value if set, zero value otherwise. +func (o *InlineResponse201) GetMesage() string { + if o == nil || o.Mesage == nil { + var ret string + return ret + } + return *o.Mesage +} + +// GetMesageOk returns a tuple with the Mesage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineResponse201) GetMesageOk() (*string, bool) { + if o == nil || o.Mesage == nil { + return nil, false + } + return o.Mesage, true +} + +// HasMesage returns a boolean if a field has been set. +func (o *InlineResponse201) HasMesage() bool { + if o != nil && o.Mesage != nil { + return true + } + + return false +} + +// SetMesage gets a reference to the given string and assigns it to the Mesage field. +func (o *InlineResponse201) SetMesage(v string) { + o.Mesage = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *InlineResponse201) GetKey() string { + if o == nil || o.Key == nil { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineResponse201) GetKeyOk() (*string, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *InlineResponse201) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *InlineResponse201) SetKey(v string) { + o.Key = &v +} + +func (o InlineResponse201) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Mesage != nil { + toSerialize["mesage"] = o.Mesage + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + return json.Marshal(toSerialize) +} + +type NullableInlineResponse201 struct { + value *InlineResponse201 + isSet bool +} + +func (v NullableInlineResponse201) Get() *InlineResponse201 { + return v.value +} + +func (v *NullableInlineResponse201) Set(val *InlineResponse201) { + v.value = val + v.isSet = true +} + +func (v NullableInlineResponse201) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineResponse201) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineResponse201(val *InlineResponse201) *NullableInlineResponse201 { + return &NullableInlineResponse201{value: val, isSet: true} +} + +func (v NullableInlineResponse201) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineResponse201) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_login_methods.go b/server/common/sftpgo/v2/openapi/model_login_methods.go new file mode 100644 index 00000000..13d16050 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_login_methods.go @@ -0,0 +1,121 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// LoginMethods Available login methods. To enable multi-step authentication you have to allow only multi-step login methods * `publickey` * `password` * `keyboard-interactive` * `publickey+password` - multi-step auth: public key and password * `publickey+keyboard-interactive` - multi-step auth: public key and keyboard interactive * `TLSCertificate` * `TLSCertificate+password` - multi-step auth: TLS client certificate and password +type LoginMethods string + +// List of LoginMethods +const ( + LOGINMETHODS_PUBLICKEY LoginMethods = "publickey" + LOGINMETHODS_PASSWORD LoginMethods = "password" + LOGINMETHODS_KEYBOARD_INTERACTIVE LoginMethods = "keyboard-interactive" + LOGINMETHODS_PUBLICKEYPASSWORD LoginMethods = "publickey+password" + LOGINMETHODS_PUBLICKEYKEYBOARD_INTERACTIVE LoginMethods = "publickey+keyboard-interactive" + LOGINMETHODS_TLS_CERTIFICATE LoginMethods = "TLSCertificate" + LOGINMETHODS_TLS_CERTIFICATEPASSWORD LoginMethods = "TLSCertificate+password" +) + +// All allowed values of LoginMethods enum +var AllowedLoginMethodsEnumValues = []LoginMethods{ + "publickey", + "password", + "keyboard-interactive", + "publickey+password", + "publickey+keyboard-interactive", + "TLSCertificate", + "TLSCertificate+password", +} + +func (v *LoginMethods) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := LoginMethods(value) + for _, existing := range AllowedLoginMethodsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LoginMethods", value) +} + +// NewLoginMethodsFromValue returns a pointer to a valid LoginMethods +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLoginMethodsFromValue(v string) (*LoginMethods, error) { + ev := LoginMethods(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LoginMethods: valid values are %v", v, AllowedLoginMethodsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LoginMethods) IsValid() bool { + for _, existing := range AllowedLoginMethodsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LoginMethods value +func (v LoginMethods) Ptr() *LoginMethods { + return &v +} + +type NullableLoginMethods struct { + value *LoginMethods + isSet bool +} + +func (v NullableLoginMethods) Get() *LoginMethods { + return v.value +} + +func (v *NullableLoginMethods) Set(val *LoginMethods) { + v.value = val + v.isSet = true +} + +func (v NullableLoginMethods) IsSet() bool { + return v.isSet +} + +func (v *NullableLoginMethods) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoginMethods(val *LoginMethods) *NullableLoginMethods { + return &NullableLoginMethods{value: val, isSet: true} +} + +func (v NullableLoginMethods) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoginMethods) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_metadata_check.go b/server/common/sftpgo/v2/openapi/model_metadata_check.go new file mode 100644 index 00000000..7cc608e5 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_metadata_check.go @@ -0,0 +1,153 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// MetadataCheck struct for MetadataCheck +type MetadataCheck struct { + // username to which the check refers + Username *string `json:"username,omitempty"` + // check start time as unix timestamp in milliseconds + StartTime *int64 `json:"start_time,omitempty"` +} + +// NewMetadataCheck instantiates a new MetadataCheck object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadataCheck() *MetadataCheck { + this := MetadataCheck{} + return &this +} + +// NewMetadataCheckWithDefaults instantiates a new MetadataCheck object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataCheckWithDefaults() *MetadataCheck { + this := MetadataCheck{} + return &this +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *MetadataCheck) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataCheck) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *MetadataCheck) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *MetadataCheck) SetUsername(v string) { + o.Username = &v +} + +// GetStartTime returns the StartTime field value if set, zero value otherwise. +func (o *MetadataCheck) GetStartTime() int64 { + if o == nil || o.StartTime == nil { + var ret int64 + return ret + } + return *o.StartTime +} + +// GetStartTimeOk returns a tuple with the StartTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataCheck) GetStartTimeOk() (*int64, bool) { + if o == nil || o.StartTime == nil { + return nil, false + } + return o.StartTime, true +} + +// HasStartTime returns a boolean if a field has been set. +func (o *MetadataCheck) HasStartTime() bool { + if o != nil && o.StartTime != nil { + return true + } + + return false +} + +// SetStartTime gets a reference to the given int64 and assigns it to the StartTime field. +func (o *MetadataCheck) SetStartTime(v int64) { + o.StartTime = &v +} + +func (o MetadataCheck) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.StartTime != nil { + toSerialize["start_time"] = o.StartTime + } + return json.Marshal(toSerialize) +} + +type NullableMetadataCheck struct { + value *MetadataCheck + isSet bool +} + +func (v NullableMetadataCheck) Get() *MetadataCheck { + return v.value +} + +func (v *NullableMetadataCheck) Set(val *MetadataCheck) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataCheck) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataCheck) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataCheck(val *MetadataCheck) *NullableMetadataCheck { + return &NullableMetadataCheck{value: val, isSet: true} +} + +func (v NullableMetadataCheck) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataCheck) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_mfa_protocols.go b/server/common/sftpgo/v2/openapi/model_mfa_protocols.go new file mode 100644 index 00000000..3e70f13f --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_mfa_protocols.go @@ -0,0 +1,113 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// MFAProtocols Protocols: * `SSH` - includes both SFTP and SSH commands * `FTP` - plain FTP and FTPES/FTPS * `HTTP` - WebClient/REST API +type MFAProtocols string + +// List of MFAProtocols +const ( + MFAPROTOCOLS_SSH MFAProtocols = "SSH" + MFAPROTOCOLS_FTP MFAProtocols = "FTP" + MFAPROTOCOLS_HTTP MFAProtocols = "HTTP" +) + +// All allowed values of MFAProtocols enum +var AllowedMFAProtocolsEnumValues = []MFAProtocols{ + "SSH", + "FTP", + "HTTP", +} + +func (v *MFAProtocols) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := MFAProtocols(value) + for _, existing := range AllowedMFAProtocolsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid MFAProtocols", value) +} + +// NewMFAProtocolsFromValue returns a pointer to a valid MFAProtocols +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewMFAProtocolsFromValue(v string) (*MFAProtocols, error) { + ev := MFAProtocols(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for MFAProtocols: valid values are %v", v, AllowedMFAProtocolsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v MFAProtocols) IsValid() bool { + for _, existing := range AllowedMFAProtocolsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MFAProtocols value +func (v MFAProtocols) Ptr() *MFAProtocols { + return &v +} + +type NullableMFAProtocols struct { + value *MFAProtocols + isSet bool +} + +func (v NullableMFAProtocols) Get() *MFAProtocols { + return v.value +} + +func (v *NullableMFAProtocols) Set(val *MFAProtocols) { + v.value = val + v.isSet = true +} + +func (v NullableMFAProtocols) IsSet() bool { + return v.isSet +} + +func (v *NullableMFAProtocols) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMFAProtocols(val *MFAProtocols) *NullableMFAProtocols { + return &NullableMFAProtocols{value: val, isSet: true} +} + +func (v NullableMFAProtocols) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMFAProtocols) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_mfa_status.go b/server/common/sftpgo/v2/openapi/model_mfa_status.go new file mode 100644 index 00000000..1dc46c21 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_mfa_status.go @@ -0,0 +1,151 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// MFAStatus struct for MFAStatus +type MFAStatus struct { + IsActive *bool `json:"is_active,omitempty"` + TotpConfigs []TOTPConfig `json:"totp_configs,omitempty"` +} + +// NewMFAStatus instantiates a new MFAStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMFAStatus() *MFAStatus { + this := MFAStatus{} + return &this +} + +// NewMFAStatusWithDefaults instantiates a new MFAStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMFAStatusWithDefaults() *MFAStatus { + this := MFAStatus{} + return &this +} + +// GetIsActive returns the IsActive field value if set, zero value otherwise. +func (o *MFAStatus) GetIsActive() bool { + if o == nil || o.IsActive == nil { + var ret bool + return ret + } + return *o.IsActive +} + +// GetIsActiveOk returns a tuple with the IsActive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MFAStatus) GetIsActiveOk() (*bool, bool) { + if o == nil || o.IsActive == nil { + return nil, false + } + return o.IsActive, true +} + +// HasIsActive returns a boolean if a field has been set. +func (o *MFAStatus) HasIsActive() bool { + if o != nil && o.IsActive != nil { + return true + } + + return false +} + +// SetIsActive gets a reference to the given bool and assigns it to the IsActive field. +func (o *MFAStatus) SetIsActive(v bool) { + o.IsActive = &v +} + +// GetTotpConfigs returns the TotpConfigs field value if set, zero value otherwise. +func (o *MFAStatus) GetTotpConfigs() []TOTPConfig { + if o == nil || o.TotpConfigs == nil { + var ret []TOTPConfig + return ret + } + return o.TotpConfigs +} + +// GetTotpConfigsOk returns a tuple with the TotpConfigs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MFAStatus) GetTotpConfigsOk() ([]TOTPConfig, bool) { + if o == nil || o.TotpConfigs == nil { + return nil, false + } + return o.TotpConfigs, true +} + +// HasTotpConfigs returns a boolean if a field has been set. +func (o *MFAStatus) HasTotpConfigs() bool { + if o != nil && o.TotpConfigs != nil { + return true + } + + return false +} + +// SetTotpConfigs gets a reference to the given []TOTPConfig and assigns it to the TotpConfigs field. +func (o *MFAStatus) SetTotpConfigs(v []TOTPConfig) { + o.TotpConfigs = v +} + +func (o MFAStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.IsActive != nil { + toSerialize["is_active"] = o.IsActive + } + if o.TotpConfigs != nil { + toSerialize["totp_configs"] = o.TotpConfigs + } + return json.Marshal(toSerialize) +} + +type NullableMFAStatus struct { + value *MFAStatus + isSet bool +} + +func (v NullableMFAStatus) Get() *MFAStatus { + return v.value +} + +func (v *NullableMFAStatus) Set(val *MFAStatus) { + v.value = val + v.isSet = true +} + +func (v NullableMFAStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableMFAStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMFAStatus(val *MFAStatus) *NullableMFAStatus { + return &NullableMFAStatus{value: val, isSet: true} +} + +func (v NullableMFAStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMFAStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_patterns_filter.go b/server/common/sftpgo/v2/openapi/model_patterns_filter.go new file mode 100644 index 00000000..1b505363 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_patterns_filter.go @@ -0,0 +1,227 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// PatternsFilter struct for PatternsFilter +type PatternsFilter struct { + // exposed virtual path, if no other specific filter is defined, the filter applies for sub directories too. For example if filters are defined for the paths \"/\" and \"/sub\" then the filters for \"/\" are applied for any file outside the \"/sub\" directory + Path *string `json:"path,omitempty"` + // list of, case insensitive, allowed shell like patterns. + AllowedPatterns []string `json:"allowed_patterns,omitempty"` + // list of, case insensitive, denied shell like patterns. Denied patterns are evaluated before the allowed ones + DeniedPatterns []string `json:"denied_patterns,omitempty"` + // Deny policies * `0` - default policy. Denied files/directories matching the filters are visible in directory listing but cannot be uploaded/downloaded/overwritten/renamed * `1` - deny policy hide. This policy applies the same restrictions as the default one and denied files/directories matching the filters will also be hidden in directory listing. This mode may cause performance issues for large directories + DenyPolicy *int32 `json:"deny_policy,omitempty"` +} + +// NewPatternsFilter instantiates a new PatternsFilter object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPatternsFilter() *PatternsFilter { + this := PatternsFilter{} + return &this +} + +// NewPatternsFilterWithDefaults instantiates a new PatternsFilter object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPatternsFilterWithDefaults() *PatternsFilter { + this := PatternsFilter{} + return &this +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *PatternsFilter) GetPath() string { + if o == nil || o.Path == nil { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatternsFilter) GetPathOk() (*string, bool) { + if o == nil || o.Path == nil { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *PatternsFilter) HasPath() bool { + if o != nil && o.Path != nil { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *PatternsFilter) SetPath(v string) { + o.Path = &v +} + +// GetAllowedPatterns returns the AllowedPatterns field value if set, zero value otherwise. +func (o *PatternsFilter) GetAllowedPatterns() []string { + if o == nil || o.AllowedPatterns == nil { + var ret []string + return ret + } + return o.AllowedPatterns +} + +// GetAllowedPatternsOk returns a tuple with the AllowedPatterns field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatternsFilter) GetAllowedPatternsOk() ([]string, bool) { + if o == nil || o.AllowedPatterns == nil { + return nil, false + } + return o.AllowedPatterns, true +} + +// HasAllowedPatterns returns a boolean if a field has been set. +func (o *PatternsFilter) HasAllowedPatterns() bool { + if o != nil && o.AllowedPatterns != nil { + return true + } + + return false +} + +// SetAllowedPatterns gets a reference to the given []string and assigns it to the AllowedPatterns field. +func (o *PatternsFilter) SetAllowedPatterns(v []string) { + o.AllowedPatterns = v +} + +// GetDeniedPatterns returns the DeniedPatterns field value if set, zero value otherwise. +func (o *PatternsFilter) GetDeniedPatterns() []string { + if o == nil || o.DeniedPatterns == nil { + var ret []string + return ret + } + return o.DeniedPatterns +} + +// GetDeniedPatternsOk returns a tuple with the DeniedPatterns field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatternsFilter) GetDeniedPatternsOk() ([]string, bool) { + if o == nil || o.DeniedPatterns == nil { + return nil, false + } + return o.DeniedPatterns, true +} + +// HasDeniedPatterns returns a boolean if a field has been set. +func (o *PatternsFilter) HasDeniedPatterns() bool { + if o != nil && o.DeniedPatterns != nil { + return true + } + + return false +} + +// SetDeniedPatterns gets a reference to the given []string and assigns it to the DeniedPatterns field. +func (o *PatternsFilter) SetDeniedPatterns(v []string) { + o.DeniedPatterns = v +} + +// GetDenyPolicy returns the DenyPolicy field value if set, zero value otherwise. +func (o *PatternsFilter) GetDenyPolicy() int32 { + if o == nil || o.DenyPolicy == nil { + var ret int32 + return ret + } + return *o.DenyPolicy +} + +// GetDenyPolicyOk returns a tuple with the DenyPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatternsFilter) GetDenyPolicyOk() (*int32, bool) { + if o == nil || o.DenyPolicy == nil { + return nil, false + } + return o.DenyPolicy, true +} + +// HasDenyPolicy returns a boolean if a field has been set. +func (o *PatternsFilter) HasDenyPolicy() bool { + if o != nil && o.DenyPolicy != nil { + return true + } + + return false +} + +// SetDenyPolicy gets a reference to the given int32 and assigns it to the DenyPolicy field. +func (o *PatternsFilter) SetDenyPolicy(v int32) { + o.DenyPolicy = &v +} + +func (o PatternsFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Path != nil { + toSerialize["path"] = o.Path + } + if o.AllowedPatterns != nil { + toSerialize["allowed_patterns"] = o.AllowedPatterns + } + if o.DeniedPatterns != nil { + toSerialize["denied_patterns"] = o.DeniedPatterns + } + if o.DenyPolicy != nil { + toSerialize["deny_policy"] = o.DenyPolicy + } + return json.Marshal(toSerialize) +} + +type NullablePatternsFilter struct { + value *PatternsFilter + isSet bool +} + +func (v NullablePatternsFilter) Get() *PatternsFilter { + return v.value +} + +func (v *NullablePatternsFilter) Set(val *PatternsFilter) { + v.value = val + v.isSet = true +} + +func (v NullablePatternsFilter) IsSet() bool { + return v.isSet +} + +func (v *NullablePatternsFilter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatternsFilter(val *PatternsFilter) *NullablePatternsFilter { + return &NullablePatternsFilter{value: val, isSet: true} +} + +func (v NullablePatternsFilter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatternsFilter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_permission.go b/server/common/sftpgo/v2/openapi/model_permission.go new file mode 100644 index 00000000..3c151aaf --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_permission.go @@ -0,0 +1,139 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// Permission Permissions: * `*` - all permissions are granted * `list` - list items is allowed * `download` - download files is allowed * `upload` - upload files is allowed * `overwrite` - overwrite an existing file, while uploading, is allowed. upload permission is required to allow file overwrite * `delete` - delete files or directories is allowed * `delete_files` - delete files is allowed * `delete_dirs` - delete directories is allowed * `rename` - rename files or directories is allowed * `rename_files` - rename files is allowed * `rename_dirs` - rename directories is allowed * `create_dirs` - create directories is allowed * `create_symlinks` - create links is allowed * `chmod` changing file or directory permissions is allowed * `chown` changing file or directory owner and group is allowed * `chtimes` changing file or directory access and modification time is allowed +type Permission string + +// List of Permission +const ( + PERMISSION_STAR Permission = "*" + PERMISSION_LIST Permission = "list" + PERMISSION_DOWNLOAD Permission = "download" + PERMISSION_UPLOAD Permission = "upload" + PERMISSION_OVERWRITE Permission = "overwrite" + PERMISSION_DELETE Permission = "delete" + PERMISSION_DELETE_FILES Permission = "delete_files" + PERMISSION_DELETE_DIRS Permission = "delete_dirs" + PERMISSION_RENAME Permission = "rename" + PERMISSION_RENAME_FILES Permission = "rename_files" + PERMISSION_RENAME_DIRS Permission = "rename_dirs" + PERMISSION_CREATE_DIRS Permission = "create_dirs" + PERMISSION_CREATE_SYMLINKS Permission = "create_symlinks" + PERMISSION_CHMOD Permission = "chmod" + PERMISSION_CHOWN Permission = "chown" + PERMISSION_CHTIMES Permission = "chtimes" +) + +// All allowed values of Permission enum +var AllowedPermissionEnumValues = []Permission{ + "*", + "list", + "download", + "upload", + "overwrite", + "delete", + "delete_files", + "delete_dirs", + "rename", + "rename_files", + "rename_dirs", + "create_dirs", + "create_symlinks", + "chmod", + "chown", + "chtimes", +} + +func (v *Permission) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Permission(value) + for _, existing := range AllowedPermissionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Permission", value) +} + +// NewPermissionFromValue returns a pointer to a valid Permission +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPermissionFromValue(v string) (*Permission, error) { + ev := Permission(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Permission: valid values are %v", v, AllowedPermissionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Permission) IsValid() bool { + for _, existing := range AllowedPermissionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Permission value +func (v Permission) Ptr() *Permission { + return &v +} + +type NullablePermission struct { + value *Permission + isSet bool +} + +func (v NullablePermission) Get() *Permission { + return v.value +} + +func (v *NullablePermission) Set(val *Permission) { + v.value = val + v.isSet = true +} + +func (v NullablePermission) IsSet() bool { + return v.isSet +} + +func (v *NullablePermission) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePermission(val *Permission) *NullablePermission { + return &NullablePermission{value: val, isSet: true} +} + +func (v NullablePermission) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePermission) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_provider_event.go b/server/common/sftpgo/v2/openapi/model_provider_event.go new file mode 100644 index 00000000..34a4409d --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_provider_event.go @@ -0,0 +1,368 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// ProviderEvent struct for ProviderEvent +type ProviderEvent struct { + Id *string `json:"id,omitempty"` + // unix timestamp in nanoseconds + Timestamp *int64 `json:"timestamp,omitempty"` + Action *ProviderEventAction `json:"action,omitempty"` + Username *string `json:"username,omitempty"` + Ip *string `json:"ip,omitempty"` + ObjectType *ProviderEventObjectType `json:"object_type,omitempty"` + ObjectName *string `json:"object_name,omitempty"` + InstanceId *string `json:"instance_id,omitempty"` +} + +// NewProviderEvent instantiates a new ProviderEvent object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProviderEvent() *ProviderEvent { + this := ProviderEvent{} + return &this +} + +// NewProviderEventWithDefaults instantiates a new ProviderEvent object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProviderEventWithDefaults() *ProviderEvent { + this := ProviderEvent{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ProviderEvent) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProviderEvent) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ProviderEvent) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ProviderEvent) SetId(v string) { + o.Id = &v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *ProviderEvent) GetTimestamp() int64 { + if o == nil || o.Timestamp == nil { + var ret int64 + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProviderEvent) GetTimestampOk() (*int64, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *ProviderEvent) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given int64 and assigns it to the Timestamp field. +func (o *ProviderEvent) SetTimestamp(v int64) { + o.Timestamp = &v +} + +// GetAction returns the Action field value if set, zero value otherwise. +func (o *ProviderEvent) GetAction() ProviderEventAction { + if o == nil || o.Action == nil { + var ret ProviderEventAction + return ret + } + return *o.Action +} + +// GetActionOk returns a tuple with the Action field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProviderEvent) GetActionOk() (*ProviderEventAction, bool) { + if o == nil || o.Action == nil { + return nil, false + } + return o.Action, true +} + +// HasAction returns a boolean if a field has been set. +func (o *ProviderEvent) HasAction() bool { + if o != nil && o.Action != nil { + return true + } + + return false +} + +// SetAction gets a reference to the given ProviderEventAction and assigns it to the Action field. +func (o *ProviderEvent) SetAction(v ProviderEventAction) { + o.Action = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *ProviderEvent) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProviderEvent) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *ProviderEvent) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *ProviderEvent) SetUsername(v string) { + o.Username = &v +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *ProviderEvent) GetIp() string { + if o == nil || o.Ip == nil { + var ret string + return ret + } + return *o.Ip +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProviderEvent) GetIpOk() (*string, bool) { + if o == nil || o.Ip == nil { + return nil, false + } + return o.Ip, true +} + +// HasIp returns a boolean if a field has been set. +func (o *ProviderEvent) HasIp() bool { + if o != nil && o.Ip != nil { + return true + } + + return false +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *ProviderEvent) SetIp(v string) { + o.Ip = &v +} + +// GetObjectType returns the ObjectType field value if set, zero value otherwise. +func (o *ProviderEvent) GetObjectType() ProviderEventObjectType { + if o == nil || o.ObjectType == nil { + var ret ProviderEventObjectType + return ret + } + return *o.ObjectType +} + +// GetObjectTypeOk returns a tuple with the ObjectType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProviderEvent) GetObjectTypeOk() (*ProviderEventObjectType, bool) { + if o == nil || o.ObjectType == nil { + return nil, false + } + return o.ObjectType, true +} + +// HasObjectType returns a boolean if a field has been set. +func (o *ProviderEvent) HasObjectType() bool { + if o != nil && o.ObjectType != nil { + return true + } + + return false +} + +// SetObjectType gets a reference to the given ProviderEventObjectType and assigns it to the ObjectType field. +func (o *ProviderEvent) SetObjectType(v ProviderEventObjectType) { + o.ObjectType = &v +} + +// GetObjectName returns the ObjectName field value if set, zero value otherwise. +func (o *ProviderEvent) GetObjectName() string { + if o == nil || o.ObjectName == nil { + var ret string + return ret + } + return *o.ObjectName +} + +// GetObjectNameOk returns a tuple with the ObjectName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProviderEvent) GetObjectNameOk() (*string, bool) { + if o == nil || o.ObjectName == nil { + return nil, false + } + return o.ObjectName, true +} + +// HasObjectName returns a boolean if a field has been set. +func (o *ProviderEvent) HasObjectName() bool { + if o != nil && o.ObjectName != nil { + return true + } + + return false +} + +// SetObjectName gets a reference to the given string and assigns it to the ObjectName field. +func (o *ProviderEvent) SetObjectName(v string) { + o.ObjectName = &v +} + +// GetInstanceId returns the InstanceId field value if set, zero value otherwise. +func (o *ProviderEvent) GetInstanceId() string { + if o == nil || o.InstanceId == nil { + var ret string + return ret + } + return *o.InstanceId +} + +// GetInstanceIdOk returns a tuple with the InstanceId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProviderEvent) GetInstanceIdOk() (*string, bool) { + if o == nil || o.InstanceId == nil { + return nil, false + } + return o.InstanceId, true +} + +// HasInstanceId returns a boolean if a field has been set. +func (o *ProviderEvent) HasInstanceId() bool { + if o != nil && o.InstanceId != nil { + return true + } + + return false +} + +// SetInstanceId gets a reference to the given string and assigns it to the InstanceId field. +func (o *ProviderEvent) SetInstanceId(v string) { + o.InstanceId = &v +} + +func (o ProviderEvent) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Timestamp != nil { + toSerialize["timestamp"] = o.Timestamp + } + if o.Action != nil { + toSerialize["action"] = o.Action + } + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.Ip != nil { + toSerialize["ip"] = o.Ip + } + if o.ObjectType != nil { + toSerialize["object_type"] = o.ObjectType + } + if o.ObjectName != nil { + toSerialize["object_name"] = o.ObjectName + } + if o.InstanceId != nil { + toSerialize["instance_id"] = o.InstanceId + } + return json.Marshal(toSerialize) +} + +type NullableProviderEvent struct { + value *ProviderEvent + isSet bool +} + +func (v NullableProviderEvent) Get() *ProviderEvent { + return v.value +} + +func (v *NullableProviderEvent) Set(val *ProviderEvent) { + v.value = val + v.isSet = true +} + +func (v NullableProviderEvent) IsSet() bool { + return v.isSet +} + +func (v *NullableProviderEvent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProviderEvent(val *ProviderEvent) *NullableProviderEvent { + return &NullableProviderEvent{value: val, isSet: true} +} + +func (v NullableProviderEvent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProviderEvent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_provider_event_action.go b/server/common/sftpgo/v2/openapi/model_provider_event_action.go new file mode 100644 index 00000000..d938cdbe --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_provider_event_action.go @@ -0,0 +1,113 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// ProviderEventAction the model 'ProviderEventAction' +type ProviderEventAction string + +// List of ProviderEventAction +const ( + PROVIDEREVENTACTION_ADD ProviderEventAction = "add" + PROVIDEREVENTACTION_UPDATE ProviderEventAction = "update" + PROVIDEREVENTACTION_DELETE ProviderEventAction = "delete" +) + +// All allowed values of ProviderEventAction enum +var AllowedProviderEventActionEnumValues = []ProviderEventAction{ + "add", + "update", + "delete", +} + +func (v *ProviderEventAction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ProviderEventAction(value) + for _, existing := range AllowedProviderEventActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ProviderEventAction", value) +} + +// NewProviderEventActionFromValue returns a pointer to a valid ProviderEventAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewProviderEventActionFromValue(v string) (*ProviderEventAction, error) { + ev := ProviderEventAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ProviderEventAction: valid values are %v", v, AllowedProviderEventActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ProviderEventAction) IsValid() bool { + for _, existing := range AllowedProviderEventActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ProviderEventAction value +func (v ProviderEventAction) Ptr() *ProviderEventAction { + return &v +} + +type NullableProviderEventAction struct { + value *ProviderEventAction + isSet bool +} + +func (v NullableProviderEventAction) Get() *ProviderEventAction { + return v.value +} + +func (v *NullableProviderEventAction) Set(val *ProviderEventAction) { + v.value = val + v.isSet = true +} + +func (v NullableProviderEventAction) IsSet() bool { + return v.isSet +} + +func (v *NullableProviderEventAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProviderEventAction(val *ProviderEventAction) *NullableProviderEventAction { + return &NullableProviderEventAction{value: val, isSet: true} +} + +func (v NullableProviderEventAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProviderEventAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_provider_event_object_type.go b/server/common/sftpgo/v2/openapi/model_provider_event_object_type.go new file mode 100644 index 00000000..73d58349 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_provider_event_object_type.go @@ -0,0 +1,115 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// ProviderEventObjectType the model 'ProviderEventObjectType' +type ProviderEventObjectType string + +// List of ProviderEventObjectType +const ( + PROVIDEREVENTOBJECTTYPE_USER ProviderEventObjectType = "user" + PROVIDEREVENTOBJECTTYPE_ADMIN ProviderEventObjectType = "admin" + PROVIDEREVENTOBJECTTYPE_API_KEY ProviderEventObjectType = "api_key" + PROVIDEREVENTOBJECTTYPE_SHARE ProviderEventObjectType = "share" +) + +// All allowed values of ProviderEventObjectType enum +var AllowedProviderEventObjectTypeEnumValues = []ProviderEventObjectType{ + "user", + "admin", + "api_key", + "share", +} + +func (v *ProviderEventObjectType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ProviderEventObjectType(value) + for _, existing := range AllowedProviderEventObjectTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ProviderEventObjectType", value) +} + +// NewProviderEventObjectTypeFromValue returns a pointer to a valid ProviderEventObjectType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewProviderEventObjectTypeFromValue(v string) (*ProviderEventObjectType, error) { + ev := ProviderEventObjectType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ProviderEventObjectType: valid values are %v", v, AllowedProviderEventObjectTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ProviderEventObjectType) IsValid() bool { + for _, existing := range AllowedProviderEventObjectTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ProviderEventObjectType value +func (v ProviderEventObjectType) Ptr() *ProviderEventObjectType { + return &v +} + +type NullableProviderEventObjectType struct { + value *ProviderEventObjectType + isSet bool +} + +func (v NullableProviderEventObjectType) Get() *ProviderEventObjectType { + return v.value +} + +func (v *NullableProviderEventObjectType) Set(val *ProviderEventObjectType) { + v.value = val + v.isSet = true +} + +func (v NullableProviderEventObjectType) IsSet() bool { + return v.isSet +} + +func (v *NullableProviderEventObjectType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProviderEventObjectType(val *ProviderEventObjectType) *NullableProviderEventObjectType { + return &NullableProviderEventObjectType{value: val, isSet: true} +} + +func (v NullableProviderEventObjectType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProviderEventObjectType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_pwd_change.go b/server/common/sftpgo/v2/openapi/model_pwd_change.go new file mode 100644 index 00000000..ebdff476 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_pwd_change.go @@ -0,0 +1,151 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// PwdChange struct for PwdChange +type PwdChange struct { + CurrentPassword *string `json:"current_password,omitempty"` + NewPassword *string `json:"new_password,omitempty"` +} + +// NewPwdChange instantiates a new PwdChange object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPwdChange() *PwdChange { + this := PwdChange{} + return &this +} + +// NewPwdChangeWithDefaults instantiates a new PwdChange object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPwdChangeWithDefaults() *PwdChange { + this := PwdChange{} + return &this +} + +// GetCurrentPassword returns the CurrentPassword field value if set, zero value otherwise. +func (o *PwdChange) GetCurrentPassword() string { + if o == nil || o.CurrentPassword == nil { + var ret string + return ret + } + return *o.CurrentPassword +} + +// GetCurrentPasswordOk returns a tuple with the CurrentPassword field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PwdChange) GetCurrentPasswordOk() (*string, bool) { + if o == nil || o.CurrentPassword == nil { + return nil, false + } + return o.CurrentPassword, true +} + +// HasCurrentPassword returns a boolean if a field has been set. +func (o *PwdChange) HasCurrentPassword() bool { + if o != nil && o.CurrentPassword != nil { + return true + } + + return false +} + +// SetCurrentPassword gets a reference to the given string and assigns it to the CurrentPassword field. +func (o *PwdChange) SetCurrentPassword(v string) { + o.CurrentPassword = &v +} + +// GetNewPassword returns the NewPassword field value if set, zero value otherwise. +func (o *PwdChange) GetNewPassword() string { + if o == nil || o.NewPassword == nil { + var ret string + return ret + } + return *o.NewPassword +} + +// GetNewPasswordOk returns a tuple with the NewPassword field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PwdChange) GetNewPasswordOk() (*string, bool) { + if o == nil || o.NewPassword == nil { + return nil, false + } + return o.NewPassword, true +} + +// HasNewPassword returns a boolean if a field has been set. +func (o *PwdChange) HasNewPassword() bool { + if o != nil && o.NewPassword != nil { + return true + } + + return false +} + +// SetNewPassword gets a reference to the given string and assigns it to the NewPassword field. +func (o *PwdChange) SetNewPassword(v string) { + o.NewPassword = &v +} + +func (o PwdChange) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.CurrentPassword != nil { + toSerialize["current_password"] = o.CurrentPassword + } + if o.NewPassword != nil { + toSerialize["new_password"] = o.NewPassword + } + return json.Marshal(toSerialize) +} + +type NullablePwdChange struct { + value *PwdChange + isSet bool +} + +func (v NullablePwdChange) Get() *PwdChange { + return v.value +} + +func (v *NullablePwdChange) Set(val *PwdChange) { + v.value = val + v.isSet = true +} + +func (v NullablePwdChange) IsSet() bool { + return v.isSet +} + +func (v *NullablePwdChange) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePwdChange(val *PwdChange) *NullablePwdChange { + return &NullablePwdChange{value: val, isSet: true} +} + +func (v NullablePwdChange) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePwdChange) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_quota_scan.go b/server/common/sftpgo/v2/openapi/model_quota_scan.go new file mode 100644 index 00000000..778e4bc6 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_quota_scan.go @@ -0,0 +1,153 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// QuotaScan struct for QuotaScan +type QuotaScan struct { + // username to which the quota scan refers + Username *string `json:"username,omitempty"` + // scan start time as unix timestamp in milliseconds + StartTime *int64 `json:"start_time,omitempty"` +} + +// NewQuotaScan instantiates a new QuotaScan object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaScan() *QuotaScan { + this := QuotaScan{} + return &this +} + +// NewQuotaScanWithDefaults instantiates a new QuotaScan object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaScanWithDefaults() *QuotaScan { + this := QuotaScan{} + return &this +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *QuotaScan) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QuotaScan) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *QuotaScan) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *QuotaScan) SetUsername(v string) { + o.Username = &v +} + +// GetStartTime returns the StartTime field value if set, zero value otherwise. +func (o *QuotaScan) GetStartTime() int64 { + if o == nil || o.StartTime == nil { + var ret int64 + return ret + } + return *o.StartTime +} + +// GetStartTimeOk returns a tuple with the StartTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QuotaScan) GetStartTimeOk() (*int64, bool) { + if o == nil || o.StartTime == nil { + return nil, false + } + return o.StartTime, true +} + +// HasStartTime returns a boolean if a field has been set. +func (o *QuotaScan) HasStartTime() bool { + if o != nil && o.StartTime != nil { + return true + } + + return false +} + +// SetStartTime gets a reference to the given int64 and assigns it to the StartTime field. +func (o *QuotaScan) SetStartTime(v int64) { + o.StartTime = &v +} + +func (o QuotaScan) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.StartTime != nil { + toSerialize["start_time"] = o.StartTime + } + return json.Marshal(toSerialize) +} + +type NullableQuotaScan struct { + value *QuotaScan + isSet bool +} + +func (v NullableQuotaScan) Get() *QuotaScan { + return v.value +} + +func (v *NullableQuotaScan) Set(val *QuotaScan) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaScan) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaScan) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaScan(val *QuotaScan) *NullableQuotaScan { + return &NullableQuotaScan{value: val, isSet: true} +} + +func (v NullableQuotaScan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaScan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_quota_usage.go b/server/common/sftpgo/v2/openapi/model_quota_usage.go new file mode 100644 index 00000000..8fe0be4a --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_quota_usage.go @@ -0,0 +1,151 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// QuotaUsage struct for QuotaUsage +type QuotaUsage struct { + UsedQuotaSize *int64 `json:"used_quota_size,omitempty"` + UsedQuotaFiles *int32 `json:"used_quota_files,omitempty"` +} + +// NewQuotaUsage instantiates a new QuotaUsage object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaUsage() *QuotaUsage { + this := QuotaUsage{} + return &this +} + +// NewQuotaUsageWithDefaults instantiates a new QuotaUsage object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaUsageWithDefaults() *QuotaUsage { + this := QuotaUsage{} + return &this +} + +// GetUsedQuotaSize returns the UsedQuotaSize field value if set, zero value otherwise. +func (o *QuotaUsage) GetUsedQuotaSize() int64 { + if o == nil || o.UsedQuotaSize == nil { + var ret int64 + return ret + } + return *o.UsedQuotaSize +} + +// GetUsedQuotaSizeOk returns a tuple with the UsedQuotaSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QuotaUsage) GetUsedQuotaSizeOk() (*int64, bool) { + if o == nil || o.UsedQuotaSize == nil { + return nil, false + } + return o.UsedQuotaSize, true +} + +// HasUsedQuotaSize returns a boolean if a field has been set. +func (o *QuotaUsage) HasUsedQuotaSize() bool { + if o != nil && o.UsedQuotaSize != nil { + return true + } + + return false +} + +// SetUsedQuotaSize gets a reference to the given int64 and assigns it to the UsedQuotaSize field. +func (o *QuotaUsage) SetUsedQuotaSize(v int64) { + o.UsedQuotaSize = &v +} + +// GetUsedQuotaFiles returns the UsedQuotaFiles field value if set, zero value otherwise. +func (o *QuotaUsage) GetUsedQuotaFiles() int32 { + if o == nil || o.UsedQuotaFiles == nil { + var ret int32 + return ret + } + return *o.UsedQuotaFiles +} + +// GetUsedQuotaFilesOk returns a tuple with the UsedQuotaFiles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QuotaUsage) GetUsedQuotaFilesOk() (*int32, bool) { + if o == nil || o.UsedQuotaFiles == nil { + return nil, false + } + return o.UsedQuotaFiles, true +} + +// HasUsedQuotaFiles returns a boolean if a field has been set. +func (o *QuotaUsage) HasUsedQuotaFiles() bool { + if o != nil && o.UsedQuotaFiles != nil { + return true + } + + return false +} + +// SetUsedQuotaFiles gets a reference to the given int32 and assigns it to the UsedQuotaFiles field. +func (o *QuotaUsage) SetUsedQuotaFiles(v int32) { + o.UsedQuotaFiles = &v +} + +func (o QuotaUsage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UsedQuotaSize != nil { + toSerialize["used_quota_size"] = o.UsedQuotaSize + } + if o.UsedQuotaFiles != nil { + toSerialize["used_quota_files"] = o.UsedQuotaFiles + } + return json.Marshal(toSerialize) +} + +type NullableQuotaUsage struct { + value *QuotaUsage + isSet bool +} + +func (v NullableQuotaUsage) Get() *QuotaUsage { + return v.value +} + +func (v *NullableQuotaUsage) Set(val *QuotaUsage) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaUsage) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaUsage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaUsage(val *QuotaUsage) *NullableQuotaUsage { + return &NullableQuotaUsage{value: val, isSet: true} +} + +func (v NullableQuotaUsage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaUsage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_recovery_code.go b/server/common/sftpgo/v2/openapi/model_recovery_code.go new file mode 100644 index 00000000..9c22d3bc --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_recovery_code.go @@ -0,0 +1,151 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// RecoveryCode Recovery codes to use if the user loses access to their second factor auth device. Each code can only be used once, you should use these codes to login and disable or reset 2FA for your account +type RecoveryCode struct { + Secret *Secret `json:"secret,omitempty"` + Used *bool `json:"used,omitempty"` +} + +// NewRecoveryCode instantiates a new RecoveryCode object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRecoveryCode() *RecoveryCode { + this := RecoveryCode{} + return &this +} + +// NewRecoveryCodeWithDefaults instantiates a new RecoveryCode object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRecoveryCodeWithDefaults() *RecoveryCode { + this := RecoveryCode{} + return &this +} + +// GetSecret returns the Secret field value if set, zero value otherwise. +func (o *RecoveryCode) GetSecret() Secret { + if o == nil || o.Secret == nil { + var ret Secret + return ret + } + return *o.Secret +} + +// GetSecretOk returns a tuple with the Secret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RecoveryCode) GetSecretOk() (*Secret, bool) { + if o == nil || o.Secret == nil { + return nil, false + } + return o.Secret, true +} + +// HasSecret returns a boolean if a field has been set. +func (o *RecoveryCode) HasSecret() bool { + if o != nil && o.Secret != nil { + return true + } + + return false +} + +// SetSecret gets a reference to the given Secret and assigns it to the Secret field. +func (o *RecoveryCode) SetSecret(v Secret) { + o.Secret = &v +} + +// GetUsed returns the Used field value if set, zero value otherwise. +func (o *RecoveryCode) GetUsed() bool { + if o == nil || o.Used == nil { + var ret bool + return ret + } + return *o.Used +} + +// GetUsedOk returns a tuple with the Used field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RecoveryCode) GetUsedOk() (*bool, bool) { + if o == nil || o.Used == nil { + return nil, false + } + return o.Used, true +} + +// HasUsed returns a boolean if a field has been set. +func (o *RecoveryCode) HasUsed() bool { + if o != nil && o.Used != nil { + return true + } + + return false +} + +// SetUsed gets a reference to the given bool and assigns it to the Used field. +func (o *RecoveryCode) SetUsed(v bool) { + o.Used = &v +} + +func (o RecoveryCode) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Secret != nil { + toSerialize["secret"] = o.Secret + } + if o.Used != nil { + toSerialize["used"] = o.Used + } + return json.Marshal(toSerialize) +} + +type NullableRecoveryCode struct { + value *RecoveryCode + isSet bool +} + +func (v NullableRecoveryCode) Get() *RecoveryCode { + return v.value +} + +func (v *NullableRecoveryCode) Set(val *RecoveryCode) { + v.value = val + v.isSet = true +} + +func (v NullableRecoveryCode) IsSet() bool { + return v.isSet +} + +func (v *NullableRecoveryCode) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRecoveryCode(val *RecoveryCode) *NullableRecoveryCode { + return &NullableRecoveryCode{value: val, isSet: true} +} + +func (v NullableRecoveryCode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRecoveryCode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_retention_check.go b/server/common/sftpgo/v2/openapi/model_retention_check.go new file mode 100644 index 00000000..3fc8bfd2 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_retention_check.go @@ -0,0 +1,262 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// RetentionCheck struct for RetentionCheck +type RetentionCheck struct { + // username to which the retention check refers + Username *string `json:"username,omitempty"` + Folders []FolderRetention `json:"folders,omitempty"` + // check start time as unix timestamp in milliseconds + StartTime *int64 `json:"start_time,omitempty"` + Notifications []RetentionCheckNotification `json:"notifications,omitempty"` + // if the notification method is set to \"Email\", this is the e-mail address that receives the retention check report. This field is automatically set to the email address associated with the administrator starting the check + Email *string `json:"email,omitempty"` +} + +// NewRetentionCheck instantiates a new RetentionCheck object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRetentionCheck() *RetentionCheck { + this := RetentionCheck{} + return &this +} + +// NewRetentionCheckWithDefaults instantiates a new RetentionCheck object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRetentionCheckWithDefaults() *RetentionCheck { + this := RetentionCheck{} + return &this +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *RetentionCheck) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RetentionCheck) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *RetentionCheck) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *RetentionCheck) SetUsername(v string) { + o.Username = &v +} + +// GetFolders returns the Folders field value if set, zero value otherwise. +func (o *RetentionCheck) GetFolders() []FolderRetention { + if o == nil || o.Folders == nil { + var ret []FolderRetention + return ret + } + return o.Folders +} + +// GetFoldersOk returns a tuple with the Folders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RetentionCheck) GetFoldersOk() ([]FolderRetention, bool) { + if o == nil || o.Folders == nil { + return nil, false + } + return o.Folders, true +} + +// HasFolders returns a boolean if a field has been set. +func (o *RetentionCheck) HasFolders() bool { + if o != nil && o.Folders != nil { + return true + } + + return false +} + +// SetFolders gets a reference to the given []FolderRetention and assigns it to the Folders field. +func (o *RetentionCheck) SetFolders(v []FolderRetention) { + o.Folders = v +} + +// GetStartTime returns the StartTime field value if set, zero value otherwise. +func (o *RetentionCheck) GetStartTime() int64 { + if o == nil || o.StartTime == nil { + var ret int64 + return ret + } + return *o.StartTime +} + +// GetStartTimeOk returns a tuple with the StartTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RetentionCheck) GetStartTimeOk() (*int64, bool) { + if o == nil || o.StartTime == nil { + return nil, false + } + return o.StartTime, true +} + +// HasStartTime returns a boolean if a field has been set. +func (o *RetentionCheck) HasStartTime() bool { + if o != nil && o.StartTime != nil { + return true + } + + return false +} + +// SetStartTime gets a reference to the given int64 and assigns it to the StartTime field. +func (o *RetentionCheck) SetStartTime(v int64) { + o.StartTime = &v +} + +// GetNotifications returns the Notifications field value if set, zero value otherwise. +func (o *RetentionCheck) GetNotifications() []RetentionCheckNotification { + if o == nil || o.Notifications == nil { + var ret []RetentionCheckNotification + return ret + } + return o.Notifications +} + +// GetNotificationsOk returns a tuple with the Notifications field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RetentionCheck) GetNotificationsOk() ([]RetentionCheckNotification, bool) { + if o == nil || o.Notifications == nil { + return nil, false + } + return o.Notifications, true +} + +// HasNotifications returns a boolean if a field has been set. +func (o *RetentionCheck) HasNotifications() bool { + if o != nil && o.Notifications != nil { + return true + } + + return false +} + +// SetNotifications gets a reference to the given []RetentionCheckNotification and assigns it to the Notifications field. +func (o *RetentionCheck) SetNotifications(v []RetentionCheckNotification) { + o.Notifications = v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *RetentionCheck) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RetentionCheck) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *RetentionCheck) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *RetentionCheck) SetEmail(v string) { + o.Email = &v +} + +func (o RetentionCheck) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.Folders != nil { + toSerialize["folders"] = o.Folders + } + if o.StartTime != nil { + toSerialize["start_time"] = o.StartTime + } + if o.Notifications != nil { + toSerialize["notifications"] = o.Notifications + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + return json.Marshal(toSerialize) +} + +type NullableRetentionCheck struct { + value *RetentionCheck + isSet bool +} + +func (v NullableRetentionCheck) Get() *RetentionCheck { + return v.value +} + +func (v *NullableRetentionCheck) Set(val *RetentionCheck) { + v.value = val + v.isSet = true +} + +func (v NullableRetentionCheck) IsSet() bool { + return v.isSet +} + +func (v *NullableRetentionCheck) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRetentionCheck(val *RetentionCheck) *NullableRetentionCheck { + return &NullableRetentionCheck{value: val, isSet: true} +} + +func (v NullableRetentionCheck) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRetentionCheck) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_retention_check_notification.go b/server/common/sftpgo/v2/openapi/model_retention_check_notification.go new file mode 100644 index 00000000..796e194d --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_retention_check_notification.go @@ -0,0 +1,111 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// RetentionCheckNotification Options: * `Hook` - notify result using the defined hook. A \"data_retention_hook\" must be defined in your configuration file for this to work * `Email` - notify results by email. The admin starting the retention check must have an associated email address and the SMTP server must be configured for this to work +type RetentionCheckNotification string + +// List of RetentionCheckNotification +const ( + RETENTIONCHECKNOTIFICATION_HOOK RetentionCheckNotification = "Hook" + RETENTIONCHECKNOTIFICATION_EMAIL RetentionCheckNotification = "Email" +) + +// All allowed values of RetentionCheckNotification enum +var AllowedRetentionCheckNotificationEnumValues = []RetentionCheckNotification{ + "Hook", + "Email", +} + +func (v *RetentionCheckNotification) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := RetentionCheckNotification(value) + for _, existing := range AllowedRetentionCheckNotificationEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid RetentionCheckNotification", value) +} + +// NewRetentionCheckNotificationFromValue returns a pointer to a valid RetentionCheckNotification +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRetentionCheckNotificationFromValue(v string) (*RetentionCheckNotification, error) { + ev := RetentionCheckNotification(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RetentionCheckNotification: valid values are %v", v, AllowedRetentionCheckNotificationEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RetentionCheckNotification) IsValid() bool { + for _, existing := range AllowedRetentionCheckNotificationEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RetentionCheckNotification value +func (v RetentionCheckNotification) Ptr() *RetentionCheckNotification { + return &v +} + +type NullableRetentionCheckNotification struct { + value *RetentionCheckNotification + isSet bool +} + +func (v NullableRetentionCheckNotification) Get() *RetentionCheckNotification { + return v.value +} + +func (v *NullableRetentionCheckNotification) Set(val *RetentionCheckNotification) { + v.value = val + v.isSet = true +} + +func (v NullableRetentionCheckNotification) IsSet() bool { + return v.isSet +} + +func (v *NullableRetentionCheckNotification) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRetentionCheckNotification(val *RetentionCheckNotification) *NullableRetentionCheckNotification { + return &NullableRetentionCheckNotification{value: val, isSet: true} +} + +func (v NullableRetentionCheckNotification) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRetentionCheckNotification) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_s3_config.go b/server/common/sftpgo/v2/openapi/model_s3_config.go new file mode 100644 index 00000000..16e23e70 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_s3_config.go @@ -0,0 +1,629 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// S3Config S3 Compatible Object Storage configuration details +type S3Config struct { + Bucket *string `json:"bucket,omitempty"` + Region *string `json:"region,omitempty"` + AccessKey *string `json:"access_key,omitempty"` + AccessSecret *Secret `json:"access_secret,omitempty"` + // optional endpoint + Endpoint *string `json:"endpoint,omitempty"` + StorageClass *string `json:"storage_class,omitempty"` + // The canned ACL to apply to uploaded objects. Leave empty to use the default ACL. For more information and available ACLs, see here: https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl + Acl *string `json:"acl,omitempty"` + // the buffer size (in MB) to use for multipart uploads. The minimum allowed part size is 5MB, and if this value is set to zero, the default value (5MB) for the AWS SDK will be used. The minimum allowed value is 5. + UploadPartSize *int32 `json:"upload_part_size,omitempty"` + // the number of parts to upload in parallel. If this value is set to zero, the default value (5) will be used + UploadConcurrency *int32 `json:"upload_concurrency,omitempty"` + // the maximum time allowed, in seconds, to upload a single chunk (the chunk size is defined via \"upload_part_size\"). 0 means no timeout + UploadPartMaxTime *int32 `json:"upload_part_max_time,omitempty"` + // the buffer size (in MB) to use for multipart downloads. The minimum allowed part size is 5MB, and if this value is set to zero, the default value (5MB) for the AWS SDK will be used. The minimum allowed value is 5. Ignored for partial downloads + DownloadPartSize *int32 `json:"download_part_size,omitempty"` + // the number of parts to download in parallel. If this value is set to zero, the default value (5) will be used. Ignored for partial downloads + DownloadConcurrency *int32 `json:"download_concurrency,omitempty"` + // the maximum time allowed, in seconds, to download a single chunk (the chunk size is defined via \"download_part_size\"). 0 means no timeout. Ignored for partial downloads. + DownloadPartMaxTime *int32 `json:"download_part_max_time,omitempty"` + // Set this to \"true\" to force the request to use path-style addressing, i.e., \"http://s3.amazonaws.com/BUCKET/KEY\". By default, the S3 client will use virtual hosted bucket addressing when possible (\"http://BUCKET.s3.amazonaws.com/KEY\") + ForcePathStyle *bool `json:"force_path_style,omitempty"` + // key_prefix is similar to a chroot directory for a local filesystem. If specified the user will only see contents that starts with this prefix and so you can restrict access to a specific virtual folder. The prefix, if not empty, must not start with \"/\" and must end with \"/\". If empty the whole bucket contents will be available + KeyPrefix *string `json:"key_prefix,omitempty"` +} + +// NewS3Config instantiates a new S3Config object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewS3Config() *S3Config { + this := S3Config{} + return &this +} + +// NewS3ConfigWithDefaults instantiates a new S3Config object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewS3ConfigWithDefaults() *S3Config { + this := S3Config{} + return &this +} + +// GetBucket returns the Bucket field value if set, zero value otherwise. +func (o *S3Config) GetBucket() string { + if o == nil || o.Bucket == nil { + var ret string + return ret + } + return *o.Bucket +} + +// GetBucketOk returns a tuple with the Bucket field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetBucketOk() (*string, bool) { + if o == nil || o.Bucket == nil { + return nil, false + } + return o.Bucket, true +} + +// HasBucket returns a boolean if a field has been set. +func (o *S3Config) HasBucket() bool { + if o != nil && o.Bucket != nil { + return true + } + + return false +} + +// SetBucket gets a reference to the given string and assigns it to the Bucket field. +func (o *S3Config) SetBucket(v string) { + o.Bucket = &v +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *S3Config) GetRegion() string { + if o == nil || o.Region == nil { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetRegionOk() (*string, bool) { + if o == nil || o.Region == nil { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *S3Config) HasRegion() bool { + if o != nil && o.Region != nil { + return true + } + + return false +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *S3Config) SetRegion(v string) { + o.Region = &v +} + +// GetAccessKey returns the AccessKey field value if set, zero value otherwise. +func (o *S3Config) GetAccessKey() string { + if o == nil || o.AccessKey == nil { + var ret string + return ret + } + return *o.AccessKey +} + +// GetAccessKeyOk returns a tuple with the AccessKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetAccessKeyOk() (*string, bool) { + if o == nil || o.AccessKey == nil { + return nil, false + } + return o.AccessKey, true +} + +// HasAccessKey returns a boolean if a field has been set. +func (o *S3Config) HasAccessKey() bool { + if o != nil && o.AccessKey != nil { + return true + } + + return false +} + +// SetAccessKey gets a reference to the given string and assigns it to the AccessKey field. +func (o *S3Config) SetAccessKey(v string) { + o.AccessKey = &v +} + +// GetAccessSecret returns the AccessSecret field value if set, zero value otherwise. +func (o *S3Config) GetAccessSecret() Secret { + if o == nil || o.AccessSecret == nil { + var ret Secret + return ret + } + return *o.AccessSecret +} + +// GetAccessSecretOk returns a tuple with the AccessSecret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetAccessSecretOk() (*Secret, bool) { + if o == nil || o.AccessSecret == nil { + return nil, false + } + return o.AccessSecret, true +} + +// HasAccessSecret returns a boolean if a field has been set. +func (o *S3Config) HasAccessSecret() bool { + if o != nil && o.AccessSecret != nil { + return true + } + + return false +} + +// SetAccessSecret gets a reference to the given Secret and assigns it to the AccessSecret field. +func (o *S3Config) SetAccessSecret(v Secret) { + o.AccessSecret = &v +} + +// GetEndpoint returns the Endpoint field value if set, zero value otherwise. +func (o *S3Config) GetEndpoint() string { + if o == nil || o.Endpoint == nil { + var ret string + return ret + } + return *o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetEndpointOk() (*string, bool) { + if o == nil || o.Endpoint == nil { + return nil, false + } + return o.Endpoint, true +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *S3Config) HasEndpoint() bool { + if o != nil && o.Endpoint != nil { + return true + } + + return false +} + +// SetEndpoint gets a reference to the given string and assigns it to the Endpoint field. +func (o *S3Config) SetEndpoint(v string) { + o.Endpoint = &v +} + +// GetStorageClass returns the StorageClass field value if set, zero value otherwise. +func (o *S3Config) GetStorageClass() string { + if o == nil || o.StorageClass == nil { + var ret string + return ret + } + return *o.StorageClass +} + +// GetStorageClassOk returns a tuple with the StorageClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetStorageClassOk() (*string, bool) { + if o == nil || o.StorageClass == nil { + return nil, false + } + return o.StorageClass, true +} + +// HasStorageClass returns a boolean if a field has been set. +func (o *S3Config) HasStorageClass() bool { + if o != nil && o.StorageClass != nil { + return true + } + + return false +} + +// SetStorageClass gets a reference to the given string and assigns it to the StorageClass field. +func (o *S3Config) SetStorageClass(v string) { + o.StorageClass = &v +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *S3Config) GetAcl() string { + if o == nil || o.Acl == nil { + var ret string + return ret + } + return *o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetAclOk() (*string, bool) { + if o == nil || o.Acl == nil { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *S3Config) HasAcl() bool { + if o != nil && o.Acl != nil { + return true + } + + return false +} + +// SetAcl gets a reference to the given string and assigns it to the Acl field. +func (o *S3Config) SetAcl(v string) { + o.Acl = &v +} + +// GetUploadPartSize returns the UploadPartSize field value if set, zero value otherwise. +func (o *S3Config) GetUploadPartSize() int32 { + if o == nil || o.UploadPartSize == nil { + var ret int32 + return ret + } + return *o.UploadPartSize +} + +// GetUploadPartSizeOk returns a tuple with the UploadPartSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetUploadPartSizeOk() (*int32, bool) { + if o == nil || o.UploadPartSize == nil { + return nil, false + } + return o.UploadPartSize, true +} + +// HasUploadPartSize returns a boolean if a field has been set. +func (o *S3Config) HasUploadPartSize() bool { + if o != nil && o.UploadPartSize != nil { + return true + } + + return false +} + +// SetUploadPartSize gets a reference to the given int32 and assigns it to the UploadPartSize field. +func (o *S3Config) SetUploadPartSize(v int32) { + o.UploadPartSize = &v +} + +// GetUploadConcurrency returns the UploadConcurrency field value if set, zero value otherwise. +func (o *S3Config) GetUploadConcurrency() int32 { + if o == nil || o.UploadConcurrency == nil { + var ret int32 + return ret + } + return *o.UploadConcurrency +} + +// GetUploadConcurrencyOk returns a tuple with the UploadConcurrency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetUploadConcurrencyOk() (*int32, bool) { + if o == nil || o.UploadConcurrency == nil { + return nil, false + } + return o.UploadConcurrency, true +} + +// HasUploadConcurrency returns a boolean if a field has been set. +func (o *S3Config) HasUploadConcurrency() bool { + if o != nil && o.UploadConcurrency != nil { + return true + } + + return false +} + +// SetUploadConcurrency gets a reference to the given int32 and assigns it to the UploadConcurrency field. +func (o *S3Config) SetUploadConcurrency(v int32) { + o.UploadConcurrency = &v +} + +// GetUploadPartMaxTime returns the UploadPartMaxTime field value if set, zero value otherwise. +func (o *S3Config) GetUploadPartMaxTime() int32 { + if o == nil || o.UploadPartMaxTime == nil { + var ret int32 + return ret + } + return *o.UploadPartMaxTime +} + +// GetUploadPartMaxTimeOk returns a tuple with the UploadPartMaxTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetUploadPartMaxTimeOk() (*int32, bool) { + if o == nil || o.UploadPartMaxTime == nil { + return nil, false + } + return o.UploadPartMaxTime, true +} + +// HasUploadPartMaxTime returns a boolean if a field has been set. +func (o *S3Config) HasUploadPartMaxTime() bool { + if o != nil && o.UploadPartMaxTime != nil { + return true + } + + return false +} + +// SetUploadPartMaxTime gets a reference to the given int32 and assigns it to the UploadPartMaxTime field. +func (o *S3Config) SetUploadPartMaxTime(v int32) { + o.UploadPartMaxTime = &v +} + +// GetDownloadPartSize returns the DownloadPartSize field value if set, zero value otherwise. +func (o *S3Config) GetDownloadPartSize() int32 { + if o == nil || o.DownloadPartSize == nil { + var ret int32 + return ret + } + return *o.DownloadPartSize +} + +// GetDownloadPartSizeOk returns a tuple with the DownloadPartSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetDownloadPartSizeOk() (*int32, bool) { + if o == nil || o.DownloadPartSize == nil { + return nil, false + } + return o.DownloadPartSize, true +} + +// HasDownloadPartSize returns a boolean if a field has been set. +func (o *S3Config) HasDownloadPartSize() bool { + if o != nil && o.DownloadPartSize != nil { + return true + } + + return false +} + +// SetDownloadPartSize gets a reference to the given int32 and assigns it to the DownloadPartSize field. +func (o *S3Config) SetDownloadPartSize(v int32) { + o.DownloadPartSize = &v +} + +// GetDownloadConcurrency returns the DownloadConcurrency field value if set, zero value otherwise. +func (o *S3Config) GetDownloadConcurrency() int32 { + if o == nil || o.DownloadConcurrency == nil { + var ret int32 + return ret + } + return *o.DownloadConcurrency +} + +// GetDownloadConcurrencyOk returns a tuple with the DownloadConcurrency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetDownloadConcurrencyOk() (*int32, bool) { + if o == nil || o.DownloadConcurrency == nil { + return nil, false + } + return o.DownloadConcurrency, true +} + +// HasDownloadConcurrency returns a boolean if a field has been set. +func (o *S3Config) HasDownloadConcurrency() bool { + if o != nil && o.DownloadConcurrency != nil { + return true + } + + return false +} + +// SetDownloadConcurrency gets a reference to the given int32 and assigns it to the DownloadConcurrency field. +func (o *S3Config) SetDownloadConcurrency(v int32) { + o.DownloadConcurrency = &v +} + +// GetDownloadPartMaxTime returns the DownloadPartMaxTime field value if set, zero value otherwise. +func (o *S3Config) GetDownloadPartMaxTime() int32 { + if o == nil || o.DownloadPartMaxTime == nil { + var ret int32 + return ret + } + return *o.DownloadPartMaxTime +} + +// GetDownloadPartMaxTimeOk returns a tuple with the DownloadPartMaxTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetDownloadPartMaxTimeOk() (*int32, bool) { + if o == nil || o.DownloadPartMaxTime == nil { + return nil, false + } + return o.DownloadPartMaxTime, true +} + +// HasDownloadPartMaxTime returns a boolean if a field has been set. +func (o *S3Config) HasDownloadPartMaxTime() bool { + if o != nil && o.DownloadPartMaxTime != nil { + return true + } + + return false +} + +// SetDownloadPartMaxTime gets a reference to the given int32 and assigns it to the DownloadPartMaxTime field. +func (o *S3Config) SetDownloadPartMaxTime(v int32) { + o.DownloadPartMaxTime = &v +} + +// GetForcePathStyle returns the ForcePathStyle field value if set, zero value otherwise. +func (o *S3Config) GetForcePathStyle() bool { + if o == nil || o.ForcePathStyle == nil { + var ret bool + return ret + } + return *o.ForcePathStyle +} + +// GetForcePathStyleOk returns a tuple with the ForcePathStyle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetForcePathStyleOk() (*bool, bool) { + if o == nil || o.ForcePathStyle == nil { + return nil, false + } + return o.ForcePathStyle, true +} + +// HasForcePathStyle returns a boolean if a field has been set. +func (o *S3Config) HasForcePathStyle() bool { + if o != nil && o.ForcePathStyle != nil { + return true + } + + return false +} + +// SetForcePathStyle gets a reference to the given bool and assigns it to the ForcePathStyle field. +func (o *S3Config) SetForcePathStyle(v bool) { + o.ForcePathStyle = &v +} + +// GetKeyPrefix returns the KeyPrefix field value if set, zero value otherwise. +func (o *S3Config) GetKeyPrefix() string { + if o == nil || o.KeyPrefix == nil { + var ret string + return ret + } + return *o.KeyPrefix +} + +// GetKeyPrefixOk returns a tuple with the KeyPrefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3Config) GetKeyPrefixOk() (*string, bool) { + if o == nil || o.KeyPrefix == nil { + return nil, false + } + return o.KeyPrefix, true +} + +// HasKeyPrefix returns a boolean if a field has been set. +func (o *S3Config) HasKeyPrefix() bool { + if o != nil && o.KeyPrefix != nil { + return true + } + + return false +} + +// SetKeyPrefix gets a reference to the given string and assigns it to the KeyPrefix field. +func (o *S3Config) SetKeyPrefix(v string) { + o.KeyPrefix = &v +} + +func (o S3Config) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Bucket != nil { + toSerialize["bucket"] = o.Bucket + } + if o.Region != nil { + toSerialize["region"] = o.Region + } + if o.AccessKey != nil { + toSerialize["access_key"] = o.AccessKey + } + if o.AccessSecret != nil { + toSerialize["access_secret"] = o.AccessSecret + } + if o.Endpoint != nil { + toSerialize["endpoint"] = o.Endpoint + } + if o.StorageClass != nil { + toSerialize["storage_class"] = o.StorageClass + } + if o.Acl != nil { + toSerialize["acl"] = o.Acl + } + if o.UploadPartSize != nil { + toSerialize["upload_part_size"] = o.UploadPartSize + } + if o.UploadConcurrency != nil { + toSerialize["upload_concurrency"] = o.UploadConcurrency + } + if o.UploadPartMaxTime != nil { + toSerialize["upload_part_max_time"] = o.UploadPartMaxTime + } + if o.DownloadPartSize != nil { + toSerialize["download_part_size"] = o.DownloadPartSize + } + if o.DownloadConcurrency != nil { + toSerialize["download_concurrency"] = o.DownloadConcurrency + } + if o.DownloadPartMaxTime != nil { + toSerialize["download_part_max_time"] = o.DownloadPartMaxTime + } + if o.ForcePathStyle != nil { + toSerialize["force_path_style"] = o.ForcePathStyle + } + if o.KeyPrefix != nil { + toSerialize["key_prefix"] = o.KeyPrefix + } + return json.Marshal(toSerialize) +} + +type NullableS3Config struct { + value *S3Config + isSet bool +} + +func (v NullableS3Config) Get() *S3Config { + return v.value +} + +func (v *NullableS3Config) Set(val *S3Config) { + v.value = val + v.isSet = true +} + +func (v NullableS3Config) IsSet() bool { + return v.isSet +} + +func (v *NullableS3Config) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3Config(val *S3Config) *NullableS3Config { + return &NullableS3Config{value: val, isSet: true} +} + +func (v NullableS3Config) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3Config) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_score_status.go b/server/common/sftpgo/v2/openapi/model_score_status.go new file mode 100644 index 00000000..fe9ac5a7 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_score_status.go @@ -0,0 +1,116 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// ScoreStatus struct for ScoreStatus +type ScoreStatus struct { + // if 0 the host is not listed + Score *int32 `json:"score,omitempty"` +} + +// NewScoreStatus instantiates a new ScoreStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewScoreStatus() *ScoreStatus { + this := ScoreStatus{} + return &this +} + +// NewScoreStatusWithDefaults instantiates a new ScoreStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewScoreStatusWithDefaults() *ScoreStatus { + this := ScoreStatus{} + return &this +} + +// GetScore returns the Score field value if set, zero value otherwise. +func (o *ScoreStatus) GetScore() int32 { + if o == nil || o.Score == nil { + var ret int32 + return ret + } + return *o.Score +} + +// GetScoreOk returns a tuple with the Score field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScoreStatus) GetScoreOk() (*int32, bool) { + if o == nil || o.Score == nil { + return nil, false + } + return o.Score, true +} + +// HasScore returns a boolean if a field has been set. +func (o *ScoreStatus) HasScore() bool { + if o != nil && o.Score != nil { + return true + } + + return false +} + +// SetScore gets a reference to the given int32 and assigns it to the Score field. +func (o *ScoreStatus) SetScore(v int32) { + o.Score = &v +} + +func (o ScoreStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Score != nil { + toSerialize["score"] = o.Score + } + return json.Marshal(toSerialize) +} + +type NullableScoreStatus struct { + value *ScoreStatus + isSet bool +} + +func (v NullableScoreStatus) Get() *ScoreStatus { + return v.value +} + +func (v *NullableScoreStatus) Set(val *ScoreStatus) { + v.value = val + v.isSet = true +} + +func (v NullableScoreStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableScoreStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableScoreStatus(val *ScoreStatus) *NullableScoreStatus { + return &NullableScoreStatus{value: val, isSet: true} +} + +func (v NullableScoreStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableScoreStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_secret.go b/server/common/sftpgo/v2/openapi/model_secret.go new file mode 100644 index 00000000..cb136973 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_secret.go @@ -0,0 +1,261 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// Secret The secret is encrypted before saving, so to set a new secret you must provide a payload and set the status to \"Plain\". The encryption key and additional data will be generated automatically. If you set the status to \"Redacted\" the existig secret will be preserved +type Secret struct { + // Set to \"Plain\" to add or update an existing secret, set to \"Redacted\" to preserve the existing value + Status *string `json:"status,omitempty"` + Payload *string `json:"payload,omitempty"` + Key *string `json:"key,omitempty"` + AdditionalData *string `json:"additional_data,omitempty"` + // 1 means encrypted using a master key + Mode *int32 `json:"mode,omitempty"` +} + +// NewSecret instantiates a new Secret object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSecret() *Secret { + this := Secret{} + return &this +} + +// NewSecretWithDefaults instantiates a new Secret object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSecretWithDefaults() *Secret { + this := Secret{} + return &this +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Secret) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Secret) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Secret) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Secret) SetStatus(v string) { + o.Status = &v +} + +// GetPayload returns the Payload field value if set, zero value otherwise. +func (o *Secret) GetPayload() string { + if o == nil || o.Payload == nil { + var ret string + return ret + } + return *o.Payload +} + +// GetPayloadOk returns a tuple with the Payload field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Secret) GetPayloadOk() (*string, bool) { + if o == nil || o.Payload == nil { + return nil, false + } + return o.Payload, true +} + +// HasPayload returns a boolean if a field has been set. +func (o *Secret) HasPayload() bool { + if o != nil && o.Payload != nil { + return true + } + + return false +} + +// SetPayload gets a reference to the given string and assigns it to the Payload field. +func (o *Secret) SetPayload(v string) { + o.Payload = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *Secret) GetKey() string { + if o == nil || o.Key == nil { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Secret) GetKeyOk() (*string, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *Secret) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *Secret) SetKey(v string) { + o.Key = &v +} + +// GetAdditionalData returns the AdditionalData field value if set, zero value otherwise. +func (o *Secret) GetAdditionalData() string { + if o == nil || o.AdditionalData == nil { + var ret string + return ret + } + return *o.AdditionalData +} + +// GetAdditionalDataOk returns a tuple with the AdditionalData field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Secret) GetAdditionalDataOk() (*string, bool) { + if o == nil || o.AdditionalData == nil { + return nil, false + } + return o.AdditionalData, true +} + +// HasAdditionalData returns a boolean if a field has been set. +func (o *Secret) HasAdditionalData() bool { + if o != nil && o.AdditionalData != nil { + return true + } + + return false +} + +// SetAdditionalData gets a reference to the given string and assigns it to the AdditionalData field. +func (o *Secret) SetAdditionalData(v string) { + o.AdditionalData = &v +} + +// GetMode returns the Mode field value if set, zero value otherwise. +func (o *Secret) GetMode() int32 { + if o == nil || o.Mode == nil { + var ret int32 + return ret + } + return *o.Mode +} + +// GetModeOk returns a tuple with the Mode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Secret) GetModeOk() (*int32, bool) { + if o == nil || o.Mode == nil { + return nil, false + } + return o.Mode, true +} + +// HasMode returns a boolean if a field has been set. +func (o *Secret) HasMode() bool { + if o != nil && o.Mode != nil { + return true + } + + return false +} + +// SetMode gets a reference to the given int32 and assigns it to the Mode field. +func (o *Secret) SetMode(v int32) { + o.Mode = &v +} + +func (o Secret) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Payload != nil { + toSerialize["payload"] = o.Payload + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + if o.AdditionalData != nil { + toSerialize["additional_data"] = o.AdditionalData + } + if o.Mode != nil { + toSerialize["mode"] = o.Mode + } + return json.Marshal(toSerialize) +} + +type NullableSecret struct { + value *Secret + isSet bool +} + +func (v NullableSecret) Get() *Secret { + return v.value +} + +func (v *NullableSecret) Set(val *Secret) { + v.value = val + v.isSet = true +} + +func (v NullableSecret) IsSet() bool { + return v.isSet +} + +func (v *NullableSecret) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecret(val *Secret) *NullableSecret { + return &NullableSecret{value: val, isSet: true} +} + +func (v NullableSecret) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecret) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_services_status.go b/server/common/sftpgo/v2/openapi/model_services_status.go new file mode 100644 index 00000000..2bdda9da --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_services_status.go @@ -0,0 +1,295 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// ServicesStatus struct for ServicesStatus +type ServicesStatus struct { + Ssh *SSHServiceStatus `json:"ssh,omitempty"` + Ftp *FTPServiceStatus `json:"ftp,omitempty"` + Webdav *WebDAVServiceStatus `json:"webdav,omitempty"` + DataProvider *DataProviderStatus `json:"data_provider,omitempty"` + Defender *ServicesStatusDefender `json:"defender,omitempty"` + Mfa *MFAStatus `json:"mfa,omitempty"` +} + +// NewServicesStatus instantiates a new ServicesStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServicesStatus() *ServicesStatus { + this := ServicesStatus{} + return &this +} + +// NewServicesStatusWithDefaults instantiates a new ServicesStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServicesStatusWithDefaults() *ServicesStatus { + this := ServicesStatus{} + return &this +} + +// GetSsh returns the Ssh field value if set, zero value otherwise. +func (o *ServicesStatus) GetSsh() SSHServiceStatus { + if o == nil || o.Ssh == nil { + var ret SSHServiceStatus + return ret + } + return *o.Ssh +} + +// GetSshOk returns a tuple with the Ssh field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServicesStatus) GetSshOk() (*SSHServiceStatus, bool) { + if o == nil || o.Ssh == nil { + return nil, false + } + return o.Ssh, true +} + +// HasSsh returns a boolean if a field has been set. +func (o *ServicesStatus) HasSsh() bool { + if o != nil && o.Ssh != nil { + return true + } + + return false +} + +// SetSsh gets a reference to the given SSHServiceStatus and assigns it to the Ssh field. +func (o *ServicesStatus) SetSsh(v SSHServiceStatus) { + o.Ssh = &v +} + +// GetFtp returns the Ftp field value if set, zero value otherwise. +func (o *ServicesStatus) GetFtp() FTPServiceStatus { + if o == nil || o.Ftp == nil { + var ret FTPServiceStatus + return ret + } + return *o.Ftp +} + +// GetFtpOk returns a tuple with the Ftp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServicesStatus) GetFtpOk() (*FTPServiceStatus, bool) { + if o == nil || o.Ftp == nil { + return nil, false + } + return o.Ftp, true +} + +// HasFtp returns a boolean if a field has been set. +func (o *ServicesStatus) HasFtp() bool { + if o != nil && o.Ftp != nil { + return true + } + + return false +} + +// SetFtp gets a reference to the given FTPServiceStatus and assigns it to the Ftp field. +func (o *ServicesStatus) SetFtp(v FTPServiceStatus) { + o.Ftp = &v +} + +// GetWebdav returns the Webdav field value if set, zero value otherwise. +func (o *ServicesStatus) GetWebdav() WebDAVServiceStatus { + if o == nil || o.Webdav == nil { + var ret WebDAVServiceStatus + return ret + } + return *o.Webdav +} + +// GetWebdavOk returns a tuple with the Webdav field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServicesStatus) GetWebdavOk() (*WebDAVServiceStatus, bool) { + if o == nil || o.Webdav == nil { + return nil, false + } + return o.Webdav, true +} + +// HasWebdav returns a boolean if a field has been set. +func (o *ServicesStatus) HasWebdav() bool { + if o != nil && o.Webdav != nil { + return true + } + + return false +} + +// SetWebdav gets a reference to the given WebDAVServiceStatus and assigns it to the Webdav field. +func (o *ServicesStatus) SetWebdav(v WebDAVServiceStatus) { + o.Webdav = &v +} + +// GetDataProvider returns the DataProvider field value if set, zero value otherwise. +func (o *ServicesStatus) GetDataProvider() DataProviderStatus { + if o == nil || o.DataProvider == nil { + var ret DataProviderStatus + return ret + } + return *o.DataProvider +} + +// GetDataProviderOk returns a tuple with the DataProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServicesStatus) GetDataProviderOk() (*DataProviderStatus, bool) { + if o == nil || o.DataProvider == nil { + return nil, false + } + return o.DataProvider, true +} + +// HasDataProvider returns a boolean if a field has been set. +func (o *ServicesStatus) HasDataProvider() bool { + if o != nil && o.DataProvider != nil { + return true + } + + return false +} + +// SetDataProvider gets a reference to the given DataProviderStatus and assigns it to the DataProvider field. +func (o *ServicesStatus) SetDataProvider(v DataProviderStatus) { + o.DataProvider = &v +} + +// GetDefender returns the Defender field value if set, zero value otherwise. +func (o *ServicesStatus) GetDefender() ServicesStatusDefender { + if o == nil || o.Defender == nil { + var ret ServicesStatusDefender + return ret + } + return *o.Defender +} + +// GetDefenderOk returns a tuple with the Defender field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServicesStatus) GetDefenderOk() (*ServicesStatusDefender, bool) { + if o == nil || o.Defender == nil { + return nil, false + } + return o.Defender, true +} + +// HasDefender returns a boolean if a field has been set. +func (o *ServicesStatus) HasDefender() bool { + if o != nil && o.Defender != nil { + return true + } + + return false +} + +// SetDefender gets a reference to the given ServicesStatusDefender and assigns it to the Defender field. +func (o *ServicesStatus) SetDefender(v ServicesStatusDefender) { + o.Defender = &v +} + +// GetMfa returns the Mfa field value if set, zero value otherwise. +func (o *ServicesStatus) GetMfa() MFAStatus { + if o == nil || o.Mfa == nil { + var ret MFAStatus + return ret + } + return *o.Mfa +} + +// GetMfaOk returns a tuple with the Mfa field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServicesStatus) GetMfaOk() (*MFAStatus, bool) { + if o == nil || o.Mfa == nil { + return nil, false + } + return o.Mfa, true +} + +// HasMfa returns a boolean if a field has been set. +func (o *ServicesStatus) HasMfa() bool { + if o != nil && o.Mfa != nil { + return true + } + + return false +} + +// SetMfa gets a reference to the given MFAStatus and assigns it to the Mfa field. +func (o *ServicesStatus) SetMfa(v MFAStatus) { + o.Mfa = &v +} + +func (o ServicesStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Ssh != nil { + toSerialize["ssh"] = o.Ssh + } + if o.Ftp != nil { + toSerialize["ftp"] = o.Ftp + } + if o.Webdav != nil { + toSerialize["webdav"] = o.Webdav + } + if o.DataProvider != nil { + toSerialize["data_provider"] = o.DataProvider + } + if o.Defender != nil { + toSerialize["defender"] = o.Defender + } + if o.Mfa != nil { + toSerialize["mfa"] = o.Mfa + } + return json.Marshal(toSerialize) +} + +type NullableServicesStatus struct { + value *ServicesStatus + isSet bool +} + +func (v NullableServicesStatus) Get() *ServicesStatus { + return v.value +} + +func (v *NullableServicesStatus) Set(val *ServicesStatus) { + v.value = val + v.isSet = true +} + +func (v NullableServicesStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableServicesStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServicesStatus(val *ServicesStatus) *NullableServicesStatus { + return &NullableServicesStatus{value: val, isSet: true} +} + +func (v NullableServicesStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServicesStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_services_status_defender.go b/server/common/sftpgo/v2/openapi/model_services_status_defender.go new file mode 100644 index 00000000..60bed182 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_services_status_defender.go @@ -0,0 +1,115 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// ServicesStatusDefender struct for ServicesStatusDefender +type ServicesStatusDefender struct { + IsActive *bool `json:"is_active,omitempty"` +} + +// NewServicesStatusDefender instantiates a new ServicesStatusDefender object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServicesStatusDefender() *ServicesStatusDefender { + this := ServicesStatusDefender{} + return &this +} + +// NewServicesStatusDefenderWithDefaults instantiates a new ServicesStatusDefender object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServicesStatusDefenderWithDefaults() *ServicesStatusDefender { + this := ServicesStatusDefender{} + return &this +} + +// GetIsActive returns the IsActive field value if set, zero value otherwise. +func (o *ServicesStatusDefender) GetIsActive() bool { + if o == nil || o.IsActive == nil { + var ret bool + return ret + } + return *o.IsActive +} + +// GetIsActiveOk returns a tuple with the IsActive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServicesStatusDefender) GetIsActiveOk() (*bool, bool) { + if o == nil || o.IsActive == nil { + return nil, false + } + return o.IsActive, true +} + +// HasIsActive returns a boolean if a field has been set. +func (o *ServicesStatusDefender) HasIsActive() bool { + if o != nil && o.IsActive != nil { + return true + } + + return false +} + +// SetIsActive gets a reference to the given bool and assigns it to the IsActive field. +func (o *ServicesStatusDefender) SetIsActive(v bool) { + o.IsActive = &v +} + +func (o ServicesStatusDefender) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.IsActive != nil { + toSerialize["is_active"] = o.IsActive + } + return json.Marshal(toSerialize) +} + +type NullableServicesStatusDefender struct { + value *ServicesStatusDefender + isSet bool +} + +func (v NullableServicesStatusDefender) Get() *ServicesStatusDefender { + return v.value +} + +func (v *NullableServicesStatusDefender) Set(val *ServicesStatusDefender) { + v.value = val + v.isSet = true +} + +func (v NullableServicesStatusDefender) IsSet() bool { + return v.isSet +} + +func (v *NullableServicesStatusDefender) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServicesStatusDefender(val *ServicesStatusDefender) *NullableServicesStatusDefender { + return &NullableServicesStatusDefender{value: val, isSet: true} +} + +func (v NullableServicesStatusDefender) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServicesStatusDefender) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_sftpfs_config.go b/server/common/sftpgo/v2/openapi/model_sftpfs_config.go new file mode 100644 index 00000000..710999c3 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_sftpfs_config.go @@ -0,0 +1,373 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// SFTPFsConfig struct for SFTPFsConfig +type SFTPFsConfig struct { + // remote SFTP endpoint as host:port + Endpoint *string `json:"endpoint,omitempty"` + // you can specify a password or private key or both. In the latter case the private key will be tried first. + Username *string `json:"username,omitempty"` + Password *Secret `json:"password,omitempty"` + PrivateKey *Secret `json:"private_key,omitempty"` + // SHA256 fingerprints to use for host key verification. If you don't provide any fingerprint the remote host key will not be verified, this is a security risk + Fingerprints []string `json:"fingerprints,omitempty"` + // Specifying a prefix you can restrict all operations to a given path within the remote SFTP server. + Prefix *string `json:"prefix,omitempty"` + // Concurrent reads are safe to use and disabling them will degrade performance. Some servers automatically delete files once they are downloaded. Using concurrent reads is problematic with such servers. + DisableConcurrentReads *bool `json:"disable_concurrent_reads,omitempty"` + // The size of the buffer (in MB) to use for transfers. By enabling buffering, the reads and writes, from/to the remote SFTP server, are split in multiple concurrent requests and this allows data to be transferred at a faster rate, over high latency networks, by overlapping round-trip times. With buffering enabled, resuming uploads is not supported and a file cannot be opened for both reading and writing at the same time. 0 means disabled. + BufferSize *int32 `json:"buffer_size,omitempty"` +} + +// NewSFTPFsConfig instantiates a new SFTPFsConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSFTPFsConfig() *SFTPFsConfig { + this := SFTPFsConfig{} + return &this +} + +// NewSFTPFsConfigWithDefaults instantiates a new SFTPFsConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSFTPFsConfigWithDefaults() *SFTPFsConfig { + this := SFTPFsConfig{} + return &this +} + +// GetEndpoint returns the Endpoint field value if set, zero value otherwise. +func (o *SFTPFsConfig) GetEndpoint() string { + if o == nil || o.Endpoint == nil { + var ret string + return ret + } + return *o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SFTPFsConfig) GetEndpointOk() (*string, bool) { + if o == nil || o.Endpoint == nil { + return nil, false + } + return o.Endpoint, true +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *SFTPFsConfig) HasEndpoint() bool { + if o != nil && o.Endpoint != nil { + return true + } + + return false +} + +// SetEndpoint gets a reference to the given string and assigns it to the Endpoint field. +func (o *SFTPFsConfig) SetEndpoint(v string) { + o.Endpoint = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *SFTPFsConfig) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SFTPFsConfig) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *SFTPFsConfig) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *SFTPFsConfig) SetUsername(v string) { + o.Username = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *SFTPFsConfig) GetPassword() Secret { + if o == nil || o.Password == nil { + var ret Secret + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SFTPFsConfig) GetPasswordOk() (*Secret, bool) { + if o == nil || o.Password == nil { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *SFTPFsConfig) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + +// SetPassword gets a reference to the given Secret and assigns it to the Password field. +func (o *SFTPFsConfig) SetPassword(v Secret) { + o.Password = &v +} + +// GetPrivateKey returns the PrivateKey field value if set, zero value otherwise. +func (o *SFTPFsConfig) GetPrivateKey() Secret { + if o == nil || o.PrivateKey == nil { + var ret Secret + return ret + } + return *o.PrivateKey +} + +// GetPrivateKeyOk returns a tuple with the PrivateKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SFTPFsConfig) GetPrivateKeyOk() (*Secret, bool) { + if o == nil || o.PrivateKey == nil { + return nil, false + } + return o.PrivateKey, true +} + +// HasPrivateKey returns a boolean if a field has been set. +func (o *SFTPFsConfig) HasPrivateKey() bool { + if o != nil && o.PrivateKey != nil { + return true + } + + return false +} + +// SetPrivateKey gets a reference to the given Secret and assigns it to the PrivateKey field. +func (o *SFTPFsConfig) SetPrivateKey(v Secret) { + o.PrivateKey = &v +} + +// GetFingerprints returns the Fingerprints field value if set, zero value otherwise. +func (o *SFTPFsConfig) GetFingerprints() []string { + if o == nil || o.Fingerprints == nil { + var ret []string + return ret + } + return o.Fingerprints +} + +// GetFingerprintsOk returns a tuple with the Fingerprints field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SFTPFsConfig) GetFingerprintsOk() ([]string, bool) { + if o == nil || o.Fingerprints == nil { + return nil, false + } + return o.Fingerprints, true +} + +// HasFingerprints returns a boolean if a field has been set. +func (o *SFTPFsConfig) HasFingerprints() bool { + if o != nil && o.Fingerprints != nil { + return true + } + + return false +} + +// SetFingerprints gets a reference to the given []string and assigns it to the Fingerprints field. +func (o *SFTPFsConfig) SetFingerprints(v []string) { + o.Fingerprints = v +} + +// GetPrefix returns the Prefix field value if set, zero value otherwise. +func (o *SFTPFsConfig) GetPrefix() string { + if o == nil || o.Prefix == nil { + var ret string + return ret + } + return *o.Prefix +} + +// GetPrefixOk returns a tuple with the Prefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SFTPFsConfig) GetPrefixOk() (*string, bool) { + if o == nil || o.Prefix == nil { + return nil, false + } + return o.Prefix, true +} + +// HasPrefix returns a boolean if a field has been set. +func (o *SFTPFsConfig) HasPrefix() bool { + if o != nil && o.Prefix != nil { + return true + } + + return false +} + +// SetPrefix gets a reference to the given string and assigns it to the Prefix field. +func (o *SFTPFsConfig) SetPrefix(v string) { + o.Prefix = &v +} + +// GetDisableConcurrentReads returns the DisableConcurrentReads field value if set, zero value otherwise. +func (o *SFTPFsConfig) GetDisableConcurrentReads() bool { + if o == nil || o.DisableConcurrentReads == nil { + var ret bool + return ret + } + return *o.DisableConcurrentReads +} + +// GetDisableConcurrentReadsOk returns a tuple with the DisableConcurrentReads field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SFTPFsConfig) GetDisableConcurrentReadsOk() (*bool, bool) { + if o == nil || o.DisableConcurrentReads == nil { + return nil, false + } + return o.DisableConcurrentReads, true +} + +// HasDisableConcurrentReads returns a boolean if a field has been set. +func (o *SFTPFsConfig) HasDisableConcurrentReads() bool { + if o != nil && o.DisableConcurrentReads != nil { + return true + } + + return false +} + +// SetDisableConcurrentReads gets a reference to the given bool and assigns it to the DisableConcurrentReads field. +func (o *SFTPFsConfig) SetDisableConcurrentReads(v bool) { + o.DisableConcurrentReads = &v +} + +// GetBufferSize returns the BufferSize field value if set, zero value otherwise. +func (o *SFTPFsConfig) GetBufferSize() int32 { + if o == nil || o.BufferSize == nil { + var ret int32 + return ret + } + return *o.BufferSize +} + +// GetBufferSizeOk returns a tuple with the BufferSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SFTPFsConfig) GetBufferSizeOk() (*int32, bool) { + if o == nil || o.BufferSize == nil { + return nil, false + } + return o.BufferSize, true +} + +// HasBufferSize returns a boolean if a field has been set. +func (o *SFTPFsConfig) HasBufferSize() bool { + if o != nil && o.BufferSize != nil { + return true + } + + return false +} + +// SetBufferSize gets a reference to the given int32 and assigns it to the BufferSize field. +func (o *SFTPFsConfig) SetBufferSize(v int32) { + o.BufferSize = &v +} + +func (o SFTPFsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Endpoint != nil { + toSerialize["endpoint"] = o.Endpoint + } + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.Password != nil { + toSerialize["password"] = o.Password + } + if o.PrivateKey != nil { + toSerialize["private_key"] = o.PrivateKey + } + if o.Fingerprints != nil { + toSerialize["fingerprints"] = o.Fingerprints + } + if o.Prefix != nil { + toSerialize["prefix"] = o.Prefix + } + if o.DisableConcurrentReads != nil { + toSerialize["disable_concurrent_reads"] = o.DisableConcurrentReads + } + if o.BufferSize != nil { + toSerialize["buffer_size"] = o.BufferSize + } + return json.Marshal(toSerialize) +} + +type NullableSFTPFsConfig struct { + value *SFTPFsConfig + isSet bool +} + +func (v NullableSFTPFsConfig) Get() *SFTPFsConfig { + return v.value +} + +func (v *NullableSFTPFsConfig) Set(val *SFTPFsConfig) { + v.value = val + v.isSet = true +} + +func (v NullableSFTPFsConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableSFTPFsConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSFTPFsConfig(val *SFTPFsConfig) *NullableSFTPFsConfig { + return &NullableSFTPFsConfig{value: val, isSet: true} +} + +func (v NullableSFTPFsConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSFTPFsConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_share.go b/server/common/sftpgo/v2/openapi/model_share.go new file mode 100644 index 00000000..549cafbe --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_share.go @@ -0,0 +1,593 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// Share struct for Share +type Share struct { + // auto-generated unique share identifier + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + // optional description + Description *string `json:"description,omitempty"` + Scope *ShareScope `json:"scope,omitempty"` + // paths to files or directories, for share scope write this array must contain exactly one directory. Paths will not be validated on save so you can also create them after creating the share + Paths []string `json:"paths,omitempty"` + Username *string `json:"username,omitempty"` + // creation time as unix timestamp in milliseconds + CreatedAt *int64 `json:"created_at,omitempty"` + // last update time as unix timestamp in milliseconds + UpdatedAt *int64 `json:"updated_at,omitempty"` + // last use time as unix timestamp in milliseconds + LastUseAt *int64 `json:"last_use_at,omitempty"` + // optional share expiration, as unix timestamp in milliseconds. 0 means no expiration + ExpiresAt *int64 `json:"expires_at,omitempty"` + // optional password to protect the share. The special value \"[**redacted**]\" means that a password has been set, you can use this value if you want to preserve the current password when you update a share + Password *string `json:"password,omitempty"` + // maximum allowed access tokens. 0 means no limit + MaxTokens *int32 `json:"max_tokens,omitempty"` + UsedTokens *int32 `json:"used_tokens,omitempty"` + // Limit the share availability to these IP/Mask. IP/Mask must be in CIDR notation as defined in RFC 4632 and RFC 4291, for example \"192.0.2.0/24\" or \"2001:db8::/32\". An empty list means no restrictions + AllowFrom []string `json:"allow_from,omitempty"` +} + +// NewShare instantiates a new Share object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewShare() *Share { + this := Share{} + return &this +} + +// NewShareWithDefaults instantiates a new Share object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewShareWithDefaults() *Share { + this := Share{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Share) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Share) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Share) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Share) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Share) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Share) SetName(v string) { + o.Name = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Share) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Share) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Share) SetDescription(v string) { + o.Description = &v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *Share) GetScope() ShareScope { + if o == nil || o.Scope == nil { + var ret ShareScope + return ret + } + return *o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetScopeOk() (*ShareScope, bool) { + if o == nil || o.Scope == nil { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *Share) HasScope() bool { + if o != nil && o.Scope != nil { + return true + } + + return false +} + +// SetScope gets a reference to the given ShareScope and assigns it to the Scope field. +func (o *Share) SetScope(v ShareScope) { + o.Scope = &v +} + +// GetPaths returns the Paths field value if set, zero value otherwise. +func (o *Share) GetPaths() []string { + if o == nil || o.Paths == nil { + var ret []string + return ret + } + return o.Paths +} + +// GetPathsOk returns a tuple with the Paths field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetPathsOk() ([]string, bool) { + if o == nil || o.Paths == nil { + return nil, false + } + return o.Paths, true +} + +// HasPaths returns a boolean if a field has been set. +func (o *Share) HasPaths() bool { + if o != nil && o.Paths != nil { + return true + } + + return false +} + +// SetPaths gets a reference to the given []string and assigns it to the Paths field. +func (o *Share) SetPaths(v []string) { + o.Paths = v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *Share) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *Share) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *Share) SetUsername(v string) { + o.Username = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Share) GetCreatedAt() int64 { + if o == nil || o.CreatedAt == nil { + var ret int64 + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetCreatedAtOk() (*int64, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Share) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. +func (o *Share) SetCreatedAt(v int64) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Share) GetUpdatedAt() int64 { + if o == nil || o.UpdatedAt == nil { + var ret int64 + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetUpdatedAtOk() (*int64, bool) { + if o == nil || o.UpdatedAt == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Share) HasUpdatedAt() bool { + if o != nil && o.UpdatedAt != nil { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given int64 and assigns it to the UpdatedAt field. +func (o *Share) SetUpdatedAt(v int64) { + o.UpdatedAt = &v +} + +// GetLastUseAt returns the LastUseAt field value if set, zero value otherwise. +func (o *Share) GetLastUseAt() int64 { + if o == nil || o.LastUseAt == nil { + var ret int64 + return ret + } + return *o.LastUseAt +} + +// GetLastUseAtOk returns a tuple with the LastUseAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetLastUseAtOk() (*int64, bool) { + if o == nil || o.LastUseAt == nil { + return nil, false + } + return o.LastUseAt, true +} + +// HasLastUseAt returns a boolean if a field has been set. +func (o *Share) HasLastUseAt() bool { + if o != nil && o.LastUseAt != nil { + return true + } + + return false +} + +// SetLastUseAt gets a reference to the given int64 and assigns it to the LastUseAt field. +func (o *Share) SetLastUseAt(v int64) { + o.LastUseAt = &v +} + +// GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. +func (o *Share) GetExpiresAt() int64 { + if o == nil || o.ExpiresAt == nil { + var ret int64 + return ret + } + return *o.ExpiresAt +} + +// GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetExpiresAtOk() (*int64, bool) { + if o == nil || o.ExpiresAt == nil { + return nil, false + } + return o.ExpiresAt, true +} + +// HasExpiresAt returns a boolean if a field has been set. +func (o *Share) HasExpiresAt() bool { + if o != nil && o.ExpiresAt != nil { + return true + } + + return false +} + +// SetExpiresAt gets a reference to the given int64 and assigns it to the ExpiresAt field. +func (o *Share) SetExpiresAt(v int64) { + o.ExpiresAt = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *Share) GetPassword() string { + if o == nil || o.Password == nil { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetPasswordOk() (*string, bool) { + if o == nil || o.Password == nil { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *Share) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *Share) SetPassword(v string) { + o.Password = &v +} + +// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise. +func (o *Share) GetMaxTokens() int32 { + if o == nil || o.MaxTokens == nil { + var ret int32 + return ret + } + return *o.MaxTokens +} + +// GetMaxTokensOk returns a tuple with the MaxTokens field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetMaxTokensOk() (*int32, bool) { + if o == nil || o.MaxTokens == nil { + return nil, false + } + return o.MaxTokens, true +} + +// HasMaxTokens returns a boolean if a field has been set. +func (o *Share) HasMaxTokens() bool { + if o != nil && o.MaxTokens != nil { + return true + } + + return false +} + +// SetMaxTokens gets a reference to the given int32 and assigns it to the MaxTokens field. +func (o *Share) SetMaxTokens(v int32) { + o.MaxTokens = &v +} + +// GetUsedTokens returns the UsedTokens field value if set, zero value otherwise. +func (o *Share) GetUsedTokens() int32 { + if o == nil || o.UsedTokens == nil { + var ret int32 + return ret + } + return *o.UsedTokens +} + +// GetUsedTokensOk returns a tuple with the UsedTokens field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetUsedTokensOk() (*int32, bool) { + if o == nil || o.UsedTokens == nil { + return nil, false + } + return o.UsedTokens, true +} + +// HasUsedTokens returns a boolean if a field has been set. +func (o *Share) HasUsedTokens() bool { + if o != nil && o.UsedTokens != nil { + return true + } + + return false +} + +// SetUsedTokens gets a reference to the given int32 and assigns it to the UsedTokens field. +func (o *Share) SetUsedTokens(v int32) { + o.UsedTokens = &v +} + +// GetAllowFrom returns the AllowFrom field value if set, zero value otherwise. +func (o *Share) GetAllowFrom() []string { + if o == nil || o.AllowFrom == nil { + var ret []string + return ret + } + return o.AllowFrom +} + +// GetAllowFromOk returns a tuple with the AllowFrom field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetAllowFromOk() ([]string, bool) { + if o == nil || o.AllowFrom == nil { + return nil, false + } + return o.AllowFrom, true +} + +// HasAllowFrom returns a boolean if a field has been set. +func (o *Share) HasAllowFrom() bool { + if o != nil && o.AllowFrom != nil { + return true + } + + return false +} + +// SetAllowFrom gets a reference to the given []string and assigns it to the AllowFrom field. +func (o *Share) SetAllowFrom(v []string) { + o.AllowFrom = v +} + +func (o Share) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Scope != nil { + toSerialize["scope"] = o.Scope + } + if o.Paths != nil { + toSerialize["paths"] = o.Paths + } + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.UpdatedAt != nil { + toSerialize["updated_at"] = o.UpdatedAt + } + if o.LastUseAt != nil { + toSerialize["last_use_at"] = o.LastUseAt + } + if o.ExpiresAt != nil { + toSerialize["expires_at"] = o.ExpiresAt + } + if o.Password != nil { + toSerialize["password"] = o.Password + } + if o.MaxTokens != nil { + toSerialize["max_tokens"] = o.MaxTokens + } + if o.UsedTokens != nil { + toSerialize["used_tokens"] = o.UsedTokens + } + if o.AllowFrom != nil { + toSerialize["allow_from"] = o.AllowFrom + } + return json.Marshal(toSerialize) +} + +type NullableShare struct { + value *Share + isSet bool +} + +func (v NullableShare) Get() *Share { + return v.value +} + +func (v *NullableShare) Set(val *Share) { + v.value = val + v.isSet = true +} + +func (v NullableShare) IsSet() bool { + return v.isSet +} + +func (v *NullableShare) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableShare(val *Share) *NullableShare { + return &NullableShare{value: val, isSet: true} +} + +func (v NullableShare) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableShare) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_share_scope.go b/server/common/sftpgo/v2/openapi/model_share_scope.go new file mode 100644 index 00000000..a4fb2d6a --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_share_scope.go @@ -0,0 +1,111 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// ShareScope Options: * `1` - read scope * `2` - write scope +type ShareScope int32 + +// List of ShareScope +const ( + SHARESCOPE__1 ShareScope = 1 + SHARESCOPE__2 ShareScope = 2 +) + +// All allowed values of ShareScope enum +var AllowedShareScopeEnumValues = []ShareScope{ + 1, + 2, +} + +func (v *ShareScope) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ShareScope(value) + for _, existing := range AllowedShareScopeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ShareScope", value) +} + +// NewShareScopeFromValue returns a pointer to a valid ShareScope +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewShareScopeFromValue(v int32) (*ShareScope, error) { + ev := ShareScope(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ShareScope: valid values are %v", v, AllowedShareScopeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ShareScope) IsValid() bool { + for _, existing := range AllowedShareScopeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ShareScope value +func (v ShareScope) Ptr() *ShareScope { + return &v +} + +type NullableShareScope struct { + value *ShareScope + isSet bool +} + +func (v NullableShareScope) Get() *ShareScope { + return v.value +} + +func (v *NullableShareScope) Set(val *ShareScope) { + v.value = val + v.isSet = true +} + +func (v NullableShareScope) IsSet() bool { + return v.isSet +} + +func (v *NullableShareScope) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableShareScope(val *ShareScope) *NullableShareScope { + return &NullableShareScope{value: val, isSet: true} +} + +func (v NullableShareScope) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableShareScope) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_ssh_binding.go b/server/common/sftpgo/v2/openapi/model_ssh_binding.go new file mode 100644 index 00000000..c106be4c --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_ssh_binding.go @@ -0,0 +1,190 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// SSHBinding struct for SSHBinding +type SSHBinding struct { + // TCP address the server listen on + Address *string `json:"address,omitempty"` + // the port used for serving requests + Port *int32 `json:"port,omitempty"` + // apply the proxy configuration, if any + ApplyProxyConfig *bool `json:"apply_proxy_config,omitempty"` +} + +// NewSSHBinding instantiates a new SSHBinding object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSSHBinding() *SSHBinding { + this := SSHBinding{} + return &this +} + +// NewSSHBindingWithDefaults instantiates a new SSHBinding object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSSHBindingWithDefaults() *SSHBinding { + this := SSHBinding{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *SSHBinding) GetAddress() string { + if o == nil || o.Address == nil { + var ret string + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHBinding) GetAddressOk() (*string, bool) { + if o == nil || o.Address == nil { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *SSHBinding) HasAddress() bool { + if o != nil && o.Address != nil { + return true + } + + return false +} + +// SetAddress gets a reference to the given string and assigns it to the Address field. +func (o *SSHBinding) SetAddress(v string) { + o.Address = &v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *SSHBinding) GetPort() int32 { + if o == nil || o.Port == nil { + var ret int32 + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHBinding) GetPortOk() (*int32, bool) { + if o == nil || o.Port == nil { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *SSHBinding) HasPort() bool { + if o != nil && o.Port != nil { + return true + } + + return false +} + +// SetPort gets a reference to the given int32 and assigns it to the Port field. +func (o *SSHBinding) SetPort(v int32) { + o.Port = &v +} + +// GetApplyProxyConfig returns the ApplyProxyConfig field value if set, zero value otherwise. +func (o *SSHBinding) GetApplyProxyConfig() bool { + if o == nil || o.ApplyProxyConfig == nil { + var ret bool + return ret + } + return *o.ApplyProxyConfig +} + +// GetApplyProxyConfigOk returns a tuple with the ApplyProxyConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHBinding) GetApplyProxyConfigOk() (*bool, bool) { + if o == nil || o.ApplyProxyConfig == nil { + return nil, false + } + return o.ApplyProxyConfig, true +} + +// HasApplyProxyConfig returns a boolean if a field has been set. +func (o *SSHBinding) HasApplyProxyConfig() bool { + if o != nil && o.ApplyProxyConfig != nil { + return true + } + + return false +} + +// SetApplyProxyConfig gets a reference to the given bool and assigns it to the ApplyProxyConfig field. +func (o *SSHBinding) SetApplyProxyConfig(v bool) { + o.ApplyProxyConfig = &v +} + +func (o SSHBinding) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Address != nil { + toSerialize["address"] = o.Address + } + if o.Port != nil { + toSerialize["port"] = o.Port + } + if o.ApplyProxyConfig != nil { + toSerialize["apply_proxy_config"] = o.ApplyProxyConfig + } + return json.Marshal(toSerialize) +} + +type NullableSSHBinding struct { + value *SSHBinding + isSet bool +} + +func (v NullableSSHBinding) Get() *SSHBinding { + return v.value +} + +func (v *NullableSSHBinding) Set(val *SSHBinding) { + v.value = val + v.isSet = true +} + +func (v NullableSSHBinding) IsSet() bool { + return v.isSet +} + +func (v *NullableSSHBinding) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSSHBinding(val *SSHBinding) *NullableSSHBinding { + return &NullableSSHBinding{value: val, isSet: true} +} + +func (v NullableSSHBinding) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSSHBinding) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_ssh_host_key.go b/server/common/sftpgo/v2/openapi/model_ssh_host_key.go new file mode 100644 index 00000000..93237c14 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_ssh_host_key.go @@ -0,0 +1,151 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// SSHHostKey struct for SSHHostKey +type SSHHostKey struct { + Path *string `json:"path,omitempty"` + Fingerprint *string `json:"fingerprint,omitempty"` +} + +// NewSSHHostKey instantiates a new SSHHostKey object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSSHHostKey() *SSHHostKey { + this := SSHHostKey{} + return &this +} + +// NewSSHHostKeyWithDefaults instantiates a new SSHHostKey object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSSHHostKeyWithDefaults() *SSHHostKey { + this := SSHHostKey{} + return &this +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *SSHHostKey) GetPath() string { + if o == nil || o.Path == nil { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHHostKey) GetPathOk() (*string, bool) { + if o == nil || o.Path == nil { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *SSHHostKey) HasPath() bool { + if o != nil && o.Path != nil { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *SSHHostKey) SetPath(v string) { + o.Path = &v +} + +// GetFingerprint returns the Fingerprint field value if set, zero value otherwise. +func (o *SSHHostKey) GetFingerprint() string { + if o == nil || o.Fingerprint == nil { + var ret string + return ret + } + return *o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHHostKey) GetFingerprintOk() (*string, bool) { + if o == nil || o.Fingerprint == nil { + return nil, false + } + return o.Fingerprint, true +} + +// HasFingerprint returns a boolean if a field has been set. +func (o *SSHHostKey) HasFingerprint() bool { + if o != nil && o.Fingerprint != nil { + return true + } + + return false +} + +// SetFingerprint gets a reference to the given string and assigns it to the Fingerprint field. +func (o *SSHHostKey) SetFingerprint(v string) { + o.Fingerprint = &v +} + +func (o SSHHostKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Path != nil { + toSerialize["path"] = o.Path + } + if o.Fingerprint != nil { + toSerialize["fingerprint"] = o.Fingerprint + } + return json.Marshal(toSerialize) +} + +type NullableSSHHostKey struct { + value *SSHHostKey + isSet bool +} + +func (v NullableSSHHostKey) Get() *SSHHostKey { + return v.value +} + +func (v *NullableSSHHostKey) Set(val *SSHHostKey) { + v.value = val + v.isSet = true +} + +func (v NullableSSHHostKey) IsSet() bool { + return v.isSet +} + +func (v *NullableSSHHostKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSSHHostKey(val *SSHHostKey) *NullableSSHHostKey { + return &NullableSSHHostKey{value: val, isSet: true} +} + +func (v NullableSSHHostKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSSHHostKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_ssh_service_status.go b/server/common/sftpgo/v2/openapi/model_ssh_service_status.go new file mode 100644 index 00000000..30abb647 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_ssh_service_status.go @@ -0,0 +1,225 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// SSHServiceStatus struct for SSHServiceStatus +type SSHServiceStatus struct { + IsActive *bool `json:"is_active,omitempty"` + Bindings []SSHBinding `json:"bindings,omitempty"` + HostKeys []SSHHostKey `json:"host_keys,omitempty"` + SshCommands []string `json:"ssh_commands,omitempty"` +} + +// NewSSHServiceStatus instantiates a new SSHServiceStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSSHServiceStatus() *SSHServiceStatus { + this := SSHServiceStatus{} + return &this +} + +// NewSSHServiceStatusWithDefaults instantiates a new SSHServiceStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSSHServiceStatusWithDefaults() *SSHServiceStatus { + this := SSHServiceStatus{} + return &this +} + +// GetIsActive returns the IsActive field value if set, zero value otherwise. +func (o *SSHServiceStatus) GetIsActive() bool { + if o == nil || o.IsActive == nil { + var ret bool + return ret + } + return *o.IsActive +} + +// GetIsActiveOk returns a tuple with the IsActive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHServiceStatus) GetIsActiveOk() (*bool, bool) { + if o == nil || o.IsActive == nil { + return nil, false + } + return o.IsActive, true +} + +// HasIsActive returns a boolean if a field has been set. +func (o *SSHServiceStatus) HasIsActive() bool { + if o != nil && o.IsActive != nil { + return true + } + + return false +} + +// SetIsActive gets a reference to the given bool and assigns it to the IsActive field. +func (o *SSHServiceStatus) SetIsActive(v bool) { + o.IsActive = &v +} + +// GetBindings returns the Bindings field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SSHServiceStatus) GetBindings() []SSHBinding { + if o == nil { + var ret []SSHBinding + return ret + } + return o.Bindings +} + +// GetBindingsOk returns a tuple with the Bindings field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SSHServiceStatus) GetBindingsOk() ([]SSHBinding, bool) { + if o == nil || o.Bindings == nil { + return nil, false + } + return o.Bindings, true +} + +// HasBindings returns a boolean if a field has been set. +func (o *SSHServiceStatus) HasBindings() bool { + if o != nil && o.Bindings != nil { + return true + } + + return false +} + +// SetBindings gets a reference to the given []SSHBinding and assigns it to the Bindings field. +func (o *SSHServiceStatus) SetBindings(v []SSHBinding) { + o.Bindings = v +} + +// GetHostKeys returns the HostKeys field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SSHServiceStatus) GetHostKeys() []SSHHostKey { + if o == nil { + var ret []SSHHostKey + return ret + } + return o.HostKeys +} + +// GetHostKeysOk returns a tuple with the HostKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SSHServiceStatus) GetHostKeysOk() ([]SSHHostKey, bool) { + if o == nil || o.HostKeys == nil { + return nil, false + } + return o.HostKeys, true +} + +// HasHostKeys returns a boolean if a field has been set. +func (o *SSHServiceStatus) HasHostKeys() bool { + if o != nil && o.HostKeys != nil { + return true + } + + return false +} + +// SetHostKeys gets a reference to the given []SSHHostKey and assigns it to the HostKeys field. +func (o *SSHServiceStatus) SetHostKeys(v []SSHHostKey) { + o.HostKeys = v +} + +// GetSshCommands returns the SshCommands field value if set, zero value otherwise. +func (o *SSHServiceStatus) GetSshCommands() []string { + if o == nil || o.SshCommands == nil { + var ret []string + return ret + } + return o.SshCommands +} + +// GetSshCommandsOk returns a tuple with the SshCommands field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHServiceStatus) GetSshCommandsOk() ([]string, bool) { + if o == nil || o.SshCommands == nil { + return nil, false + } + return o.SshCommands, true +} + +// HasSshCommands returns a boolean if a field has been set. +func (o *SSHServiceStatus) HasSshCommands() bool { + if o != nil && o.SshCommands != nil { + return true + } + + return false +} + +// SetSshCommands gets a reference to the given []string and assigns it to the SshCommands field. +func (o *SSHServiceStatus) SetSshCommands(v []string) { + o.SshCommands = v +} + +func (o SSHServiceStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.IsActive != nil { + toSerialize["is_active"] = o.IsActive + } + if o.Bindings != nil { + toSerialize["bindings"] = o.Bindings + } + if o.HostKeys != nil { + toSerialize["host_keys"] = o.HostKeys + } + if o.SshCommands != nil { + toSerialize["ssh_commands"] = o.SshCommands + } + return json.Marshal(toSerialize) +} + +type NullableSSHServiceStatus struct { + value *SSHServiceStatus + isSet bool +} + +func (v NullableSSHServiceStatus) Get() *SSHServiceStatus { + return v.value +} + +func (v *NullableSSHServiceStatus) Set(val *SSHServiceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableSSHServiceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableSSHServiceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSSHServiceStatus(val *SSHServiceStatus) *NullableSSHServiceStatus { + return &NullableSSHServiceStatus{value: val, isSet: true} +} + +func (v NullableSSHServiceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSSHServiceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_supported_protocols.go b/server/common/sftpgo/v2/openapi/model_supported_protocols.go new file mode 100644 index 00000000..c4384c73 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_supported_protocols.go @@ -0,0 +1,115 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// SupportedProtocols Protocols: * `SSH` - includes both SFTP and SSH commands * `FTP` - plain FTP and FTPES/FTPS * `DAV` - WebDAV over HTTP/HTTPS * `HTTP` - WebClient/REST API +type SupportedProtocols string + +// List of SupportedProtocols +const ( + SUPPORTEDPROTOCOLS_SSH SupportedProtocols = "SSH" + SUPPORTEDPROTOCOLS_FTP SupportedProtocols = "FTP" + SUPPORTEDPROTOCOLS_DAV SupportedProtocols = "DAV" + SUPPORTEDPROTOCOLS_HTTP SupportedProtocols = "HTTP" +) + +// All allowed values of SupportedProtocols enum +var AllowedSupportedProtocolsEnumValues = []SupportedProtocols{ + "SSH", + "FTP", + "DAV", + "HTTP", +} + +func (v *SupportedProtocols) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SupportedProtocols(value) + for _, existing := range AllowedSupportedProtocolsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SupportedProtocols", value) +} + +// NewSupportedProtocolsFromValue returns a pointer to a valid SupportedProtocols +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSupportedProtocolsFromValue(v string) (*SupportedProtocols, error) { + ev := SupportedProtocols(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SupportedProtocols: valid values are %v", v, AllowedSupportedProtocolsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SupportedProtocols) IsValid() bool { + for _, existing := range AllowedSupportedProtocolsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SupportedProtocols value +func (v SupportedProtocols) Ptr() *SupportedProtocols { + return &v +} + +type NullableSupportedProtocols struct { + value *SupportedProtocols + isSet bool +} + +func (v NullableSupportedProtocols) Get() *SupportedProtocols { + return v.value +} + +func (v *NullableSupportedProtocols) Set(val *SupportedProtocols) { + v.value = val + v.isSet = true +} + +func (v NullableSupportedProtocols) IsSet() bool { + return v.isSet +} + +func (v *NullableSupportedProtocols) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSupportedProtocols(val *SupportedProtocols) *NullableSupportedProtocols { + return &NullableSupportedProtocols{value: val, isSet: true} +} + +func (v NullableSupportedProtocols) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSupportedProtocols) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_token.go b/server/common/sftpgo/v2/openapi/model_token.go new file mode 100644 index 00000000..407bd337 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_token.go @@ -0,0 +1,152 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// Token struct for Token +type Token struct { + AccessToken *string `json:"access_token,omitempty"` + ExpiresAt *time.Time `json:"expires_at,omitempty"` +} + +// NewToken instantiates a new Token object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewToken() *Token { + this := Token{} + return &this +} + +// NewTokenWithDefaults instantiates a new Token object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTokenWithDefaults() *Token { + this := Token{} + return &this +} + +// GetAccessToken returns the AccessToken field value if set, zero value otherwise. +func (o *Token) GetAccessToken() string { + if o == nil || o.AccessToken == nil { + var ret string + return ret + } + return *o.AccessToken +} + +// GetAccessTokenOk returns a tuple with the AccessToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Token) GetAccessTokenOk() (*string, bool) { + if o == nil || o.AccessToken == nil { + return nil, false + } + return o.AccessToken, true +} + +// HasAccessToken returns a boolean if a field has been set. +func (o *Token) HasAccessToken() bool { + if o != nil && o.AccessToken != nil { + return true + } + + return false +} + +// SetAccessToken gets a reference to the given string and assigns it to the AccessToken field. +func (o *Token) SetAccessToken(v string) { + o.AccessToken = &v +} + +// GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. +func (o *Token) GetExpiresAt() time.Time { + if o == nil || o.ExpiresAt == nil { + var ret time.Time + return ret + } + return *o.ExpiresAt +} + +// GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Token) GetExpiresAtOk() (*time.Time, bool) { + if o == nil || o.ExpiresAt == nil { + return nil, false + } + return o.ExpiresAt, true +} + +// HasExpiresAt returns a boolean if a field has been set. +func (o *Token) HasExpiresAt() bool { + if o != nil && o.ExpiresAt != nil { + return true + } + + return false +} + +// SetExpiresAt gets a reference to the given time.Time and assigns it to the ExpiresAt field. +func (o *Token) SetExpiresAt(v time.Time) { + o.ExpiresAt = &v +} + +func (o Token) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.AccessToken != nil { + toSerialize["access_token"] = o.AccessToken + } + if o.ExpiresAt != nil { + toSerialize["expires_at"] = o.ExpiresAt + } + return json.Marshal(toSerialize) +} + +type NullableToken struct { + value *Token + isSet bool +} + +func (v NullableToken) Get() *Token { + return v.value +} + +func (v *NullableToken) Set(val *Token) { + v.value = val + v.isSet = true +} + +func (v NullableToken) IsSet() bool { + return v.isSet +} + +func (v *NullableToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableToken(val *Token) *NullableToken { + return &NullableToken{value: val, isSet: true} +} + +func (v NullableToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_totp_config.go b/server/common/sftpgo/v2/openapi/model_totp_config.go new file mode 100644 index 00000000..f8beb157 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_totp_config.go @@ -0,0 +1,187 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// TOTPConfig struct for TOTPConfig +type TOTPConfig struct { + Name *string `json:"name,omitempty"` + Issuer *string `json:"issuer,omitempty"` + Algo *TOTPHMacAlgo `json:"algo,omitempty"` +} + +// NewTOTPConfig instantiates a new TOTPConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTOTPConfig() *TOTPConfig { + this := TOTPConfig{} + return &this +} + +// NewTOTPConfigWithDefaults instantiates a new TOTPConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTOTPConfigWithDefaults() *TOTPConfig { + this := TOTPConfig{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TOTPConfig) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TOTPConfig) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *TOTPConfig) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TOTPConfig) SetName(v string) { + o.Name = &v +} + +// GetIssuer returns the Issuer field value if set, zero value otherwise. +func (o *TOTPConfig) GetIssuer() string { + if o == nil || o.Issuer == nil { + var ret string + return ret + } + return *o.Issuer +} + +// GetIssuerOk returns a tuple with the Issuer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TOTPConfig) GetIssuerOk() (*string, bool) { + if o == nil || o.Issuer == nil { + return nil, false + } + return o.Issuer, true +} + +// HasIssuer returns a boolean if a field has been set. +func (o *TOTPConfig) HasIssuer() bool { + if o != nil && o.Issuer != nil { + return true + } + + return false +} + +// SetIssuer gets a reference to the given string and assigns it to the Issuer field. +func (o *TOTPConfig) SetIssuer(v string) { + o.Issuer = &v +} + +// GetAlgo returns the Algo field value if set, zero value otherwise. +func (o *TOTPConfig) GetAlgo() TOTPHMacAlgo { + if o == nil || o.Algo == nil { + var ret TOTPHMacAlgo + return ret + } + return *o.Algo +} + +// GetAlgoOk returns a tuple with the Algo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TOTPConfig) GetAlgoOk() (*TOTPHMacAlgo, bool) { + if o == nil || o.Algo == nil { + return nil, false + } + return o.Algo, true +} + +// HasAlgo returns a boolean if a field has been set. +func (o *TOTPConfig) HasAlgo() bool { + if o != nil && o.Algo != nil { + return true + } + + return false +} + +// SetAlgo gets a reference to the given TOTPHMacAlgo and assigns it to the Algo field. +func (o *TOTPConfig) SetAlgo(v TOTPHMacAlgo) { + o.Algo = &v +} + +func (o TOTPConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Issuer != nil { + toSerialize["issuer"] = o.Issuer + } + if o.Algo != nil { + toSerialize["algo"] = o.Algo + } + return json.Marshal(toSerialize) +} + +type NullableTOTPConfig struct { + value *TOTPConfig + isSet bool +} + +func (v NullableTOTPConfig) Get() *TOTPConfig { + return v.value +} + +func (v *NullableTOTPConfig) Set(val *TOTPConfig) { + v.value = val + v.isSet = true +} + +func (v NullableTOTPConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableTOTPConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTOTPConfig(val *TOTPConfig) *NullableTOTPConfig { + return &NullableTOTPConfig{value: val, isSet: true} +} + +func (v NullableTOTPConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTOTPConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_totph_mac_algo.go b/server/common/sftpgo/v2/openapi/model_totph_mac_algo.go new file mode 100644 index 00000000..fa52caae --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_totph_mac_algo.go @@ -0,0 +1,113 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// TOTPHMacAlgo Supported HMAC algorithms for Time-based one time passwords +type TOTPHMacAlgo string + +// List of TOTPHMacAlgo +const ( + TOTPHMACALGO_SHA1 TOTPHMacAlgo = "sha1" + TOTPHMACALGO_SHA256 TOTPHMacAlgo = "sha256" + TOTPHMACALGO_SHA512 TOTPHMacAlgo = "sha512" +) + +// All allowed values of TOTPHMacAlgo enum +var AllowedTOTPHMacAlgoEnumValues = []TOTPHMacAlgo{ + "sha1", + "sha256", + "sha512", +} + +func (v *TOTPHMacAlgo) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := TOTPHMacAlgo(value) + for _, existing := range AllowedTOTPHMacAlgoEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid TOTPHMacAlgo", value) +} + +// NewTOTPHMacAlgoFromValue returns a pointer to a valid TOTPHMacAlgo +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTOTPHMacAlgoFromValue(v string) (*TOTPHMacAlgo, error) { + ev := TOTPHMacAlgo(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TOTPHMacAlgo: valid values are %v", v, AllowedTOTPHMacAlgoEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TOTPHMacAlgo) IsValid() bool { + for _, existing := range AllowedTOTPHMacAlgoEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TOTPHMacAlgo value +func (v TOTPHMacAlgo) Ptr() *TOTPHMacAlgo { + return &v +} + +type NullableTOTPHMacAlgo struct { + value *TOTPHMacAlgo + isSet bool +} + +func (v NullableTOTPHMacAlgo) Get() *TOTPHMacAlgo { + return v.value +} + +func (v *NullableTOTPHMacAlgo) Set(val *TOTPHMacAlgo) { + v.value = val + v.isSet = true +} + +func (v NullableTOTPHMacAlgo) IsSet() bool { + return v.isSet +} + +func (v *NullableTOTPHMacAlgo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTOTPHMacAlgo(val *TOTPHMacAlgo) *NullableTOTPHMacAlgo { + return &NullableTOTPHMacAlgo{value: val, isSet: true} +} + +func (v NullableTOTPHMacAlgo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTOTPHMacAlgo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_transfer.go b/server/common/sftpgo/v2/openapi/model_transfer.go new file mode 100644 index 00000000..1aae1aec --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_transfer.go @@ -0,0 +1,227 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// Transfer struct for Transfer +type Transfer struct { + // Operations: * `upload` * `download` + OperationType *string `json:"operation_type,omitempty"` + // file path for the upload/download + Path *string `json:"path,omitempty"` + // start time as unix timestamp in milliseconds + StartTime *int64 `json:"start_time,omitempty"` + // bytes transferred + Size *int64 `json:"size,omitempty"` +} + +// NewTransfer instantiates a new Transfer object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTransfer() *Transfer { + this := Transfer{} + return &this +} + +// NewTransferWithDefaults instantiates a new Transfer object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTransferWithDefaults() *Transfer { + this := Transfer{} + return &this +} + +// GetOperationType returns the OperationType field value if set, zero value otherwise. +func (o *Transfer) GetOperationType() string { + if o == nil || o.OperationType == nil { + var ret string + return ret + } + return *o.OperationType +} + +// GetOperationTypeOk returns a tuple with the OperationType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Transfer) GetOperationTypeOk() (*string, bool) { + if o == nil || o.OperationType == nil { + return nil, false + } + return o.OperationType, true +} + +// HasOperationType returns a boolean if a field has been set. +func (o *Transfer) HasOperationType() bool { + if o != nil && o.OperationType != nil { + return true + } + + return false +} + +// SetOperationType gets a reference to the given string and assigns it to the OperationType field. +func (o *Transfer) SetOperationType(v string) { + o.OperationType = &v +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *Transfer) GetPath() string { + if o == nil || o.Path == nil { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Transfer) GetPathOk() (*string, bool) { + if o == nil || o.Path == nil { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *Transfer) HasPath() bool { + if o != nil && o.Path != nil { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *Transfer) SetPath(v string) { + o.Path = &v +} + +// GetStartTime returns the StartTime field value if set, zero value otherwise. +func (o *Transfer) GetStartTime() int64 { + if o == nil || o.StartTime == nil { + var ret int64 + return ret + } + return *o.StartTime +} + +// GetStartTimeOk returns a tuple with the StartTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Transfer) GetStartTimeOk() (*int64, bool) { + if o == nil || o.StartTime == nil { + return nil, false + } + return o.StartTime, true +} + +// HasStartTime returns a boolean if a field has been set. +func (o *Transfer) HasStartTime() bool { + if o != nil && o.StartTime != nil { + return true + } + + return false +} + +// SetStartTime gets a reference to the given int64 and assigns it to the StartTime field. +func (o *Transfer) SetStartTime(v int64) { + o.StartTime = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Transfer) GetSize() int64 { + if o == nil || o.Size == nil { + var ret int64 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Transfer) GetSizeOk() (*int64, bool) { + if o == nil || o.Size == nil { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *Transfer) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Transfer) SetSize(v int64) { + o.Size = &v +} + +func (o Transfer) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.OperationType != nil { + toSerialize["operation_type"] = o.OperationType + } + if o.Path != nil { + toSerialize["path"] = o.Path + } + if o.StartTime != nil { + toSerialize["start_time"] = o.StartTime + } + if o.Size != nil { + toSerialize["size"] = o.Size + } + return json.Marshal(toSerialize) +} + +type NullableTransfer struct { + value *Transfer + isSet bool +} + +func (v NullableTransfer) Get() *Transfer { + return v.value +} + +func (v *NullableTransfer) Set(val *Transfer) { + v.value = val + v.isSet = true +} + +func (v NullableTransfer) IsSet() bool { + return v.isSet +} + +func (v *NullableTransfer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTransfer(val *Transfer) *NullableTransfer { + return &NullableTransfer{value: val, isSet: true} +} + +func (v NullableTransfer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTransfer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_transfer_quota_usage.go b/server/common/sftpgo/v2/openapi/model_transfer_quota_usage.go new file mode 100644 index 00000000..2a17d480 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_transfer_quota_usage.go @@ -0,0 +1,153 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// TransferQuotaUsage struct for TransferQuotaUsage +type TransferQuotaUsage struct { + // The value must be specified as bytes + UsedUploadDataTransfer *int64 `json:"used_upload_data_transfer,omitempty"` + // The value must be specified as bytes + UsedDownloadDataTransfer *int64 `json:"used_download_data_transfer,omitempty"` +} + +// NewTransferQuotaUsage instantiates a new TransferQuotaUsage object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTransferQuotaUsage() *TransferQuotaUsage { + this := TransferQuotaUsage{} + return &this +} + +// NewTransferQuotaUsageWithDefaults instantiates a new TransferQuotaUsage object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTransferQuotaUsageWithDefaults() *TransferQuotaUsage { + this := TransferQuotaUsage{} + return &this +} + +// GetUsedUploadDataTransfer returns the UsedUploadDataTransfer field value if set, zero value otherwise. +func (o *TransferQuotaUsage) GetUsedUploadDataTransfer() int64 { + if o == nil || o.UsedUploadDataTransfer == nil { + var ret int64 + return ret + } + return *o.UsedUploadDataTransfer +} + +// GetUsedUploadDataTransferOk returns a tuple with the UsedUploadDataTransfer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransferQuotaUsage) GetUsedUploadDataTransferOk() (*int64, bool) { + if o == nil || o.UsedUploadDataTransfer == nil { + return nil, false + } + return o.UsedUploadDataTransfer, true +} + +// HasUsedUploadDataTransfer returns a boolean if a field has been set. +func (o *TransferQuotaUsage) HasUsedUploadDataTransfer() bool { + if o != nil && o.UsedUploadDataTransfer != nil { + return true + } + + return false +} + +// SetUsedUploadDataTransfer gets a reference to the given int64 and assigns it to the UsedUploadDataTransfer field. +func (o *TransferQuotaUsage) SetUsedUploadDataTransfer(v int64) { + o.UsedUploadDataTransfer = &v +} + +// GetUsedDownloadDataTransfer returns the UsedDownloadDataTransfer field value if set, zero value otherwise. +func (o *TransferQuotaUsage) GetUsedDownloadDataTransfer() int64 { + if o == nil || o.UsedDownloadDataTransfer == nil { + var ret int64 + return ret + } + return *o.UsedDownloadDataTransfer +} + +// GetUsedDownloadDataTransferOk returns a tuple with the UsedDownloadDataTransfer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransferQuotaUsage) GetUsedDownloadDataTransferOk() (*int64, bool) { + if o == nil || o.UsedDownloadDataTransfer == nil { + return nil, false + } + return o.UsedDownloadDataTransfer, true +} + +// HasUsedDownloadDataTransfer returns a boolean if a field has been set. +func (o *TransferQuotaUsage) HasUsedDownloadDataTransfer() bool { + if o != nil && o.UsedDownloadDataTransfer != nil { + return true + } + + return false +} + +// SetUsedDownloadDataTransfer gets a reference to the given int64 and assigns it to the UsedDownloadDataTransfer field. +func (o *TransferQuotaUsage) SetUsedDownloadDataTransfer(v int64) { + o.UsedDownloadDataTransfer = &v +} + +func (o TransferQuotaUsage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UsedUploadDataTransfer != nil { + toSerialize["used_upload_data_transfer"] = o.UsedUploadDataTransfer + } + if o.UsedDownloadDataTransfer != nil { + toSerialize["used_download_data_transfer"] = o.UsedDownloadDataTransfer + } + return json.Marshal(toSerialize) +} + +type NullableTransferQuotaUsage struct { + value *TransferQuotaUsage + isSet bool +} + +func (v NullableTransferQuotaUsage) Get() *TransferQuotaUsage { + return v.value +} + +func (v *NullableTransferQuotaUsage) Set(val *TransferQuotaUsage) { + v.value = val + v.isSet = true +} + +func (v NullableTransferQuotaUsage) IsSet() bool { + return v.isSet +} + +func (v *NullableTransferQuotaUsage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTransferQuotaUsage(val *TransferQuotaUsage) *NullableTransferQuotaUsage { + return &NullableTransferQuotaUsage{value: val, isSet: true} +} + +func (v NullableTransferQuotaUsage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTransferQuotaUsage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_user.go b/server/common/sftpgo/v2/openapi/model_user.go new file mode 100644 index 00000000..61786459 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_user.go @@ -0,0 +1,1257 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// User struct for User +type User struct { + Id *int32 `json:"id,omitempty"` + // status: * `0` user is disabled, login is not allowed * `1` user is enabled + Status *int32 `json:"status,omitempty"` + // username is unique + Username *string `json:"username,omitempty"` + Email *string `json:"email,omitempty"` + // optional description, for example the user full name + Description *string `json:"description,omitempty"` + // expiration date as unix timestamp in milliseconds. An expired account cannot login. 0 means no expiration + ExpirationDate *int64 `json:"expiration_date,omitempty"` + // password or public key/SSH user certificate are mandatory. If the password has no known hashing algo prefix it will be stored, by default, using bcrypt, argon2id is supported too. You can send a password hashed as bcrypt ($2a$ prefix), argon2id, pbkdf2 or unix crypt and it will be stored as is. For security reasons this field is omitted when you search/get users + Password *string `json:"password,omitempty"` + // Public keys in OpenSSH format. A password or at least one public key/SSH user certificate are mandatory. + PublicKeys []string `json:"public_keys,omitempty"` + // path to the user home directory. The user cannot upload or download files outside this directory. SFTPGo tries to automatically create this folder if missing. Must be an absolute path + HomeDir *string `json:"home_dir,omitempty"` + // mapping between virtual SFTPGo paths and filesystem paths outside the user home directory. Supported for local filesystem only. If one or more of the specified folders are not inside the dataprovider they will be automatically created. You have to create the folder on the filesystem yourself + VirtualFolders []VirtualFolder `json:"virtual_folders,omitempty"` + // if you run SFTPGo as root user, the created files and directories will be assigned to this uid. 0 means no change, the owner will be the user that runs SFTPGo. Ignored on windows + Uid *int32 `json:"uid,omitempty"` + // if you run SFTPGo as root user, the created files and directories will be assigned to this gid. 0 means no change, the group will be the one of the user that runs SFTPGo. Ignored on windows + Gid *int32 `json:"gid,omitempty"` + // Limit the sessions that a user can open. 0 means unlimited + MaxSessions *int32 `json:"max_sessions,omitempty"` + // Quota as size in bytes. 0 menas unlimited. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed + QuotaSize *int64 `json:"quota_size,omitempty"` + // Quota as number of files. 0 menas unlimited. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed + QuotaFiles *int32 `json:"quota_files,omitempty"` + //Permissions []map[string][]Permission `json:"permissions,omitempty"` + Permissions map[string][]Permission `json:"permissions,omitempty"` + UsedQuotaSize *int64 `json:"used_quota_size,omitempty"` + UsedQuotaFiles *int32 `json:"used_quota_files,omitempty"` + // Last quota update as unix timestamp in milliseconds + LastQuotaUpdate *int64 `json:"last_quota_update,omitempty"` + // Maximum upload bandwidth as KB/s, 0 means unlimited + UploadBandwidth *int32 `json:"upload_bandwidth,omitempty"` + // Maximum download bandwidth as KB/s, 0 means unlimited + DownloadBandwidth *int32 `json:"download_bandwidth,omitempty"` + // Maximum data transfer allowed for uploads as MB. 0 means no limit + UploadDataTransfer *int32 `json:"upload_data_transfer,omitempty"` + // Maximum data transfer allowed for downloads as MB. 0 means no limit + DownloadDataTransfer *int32 `json:"download_data_transfer,omitempty"` + // Maximum total data transfer as MB. 0 means unlimited. You can set a total data transfer instead of the individual values for uploads and downloads + TotalDataTransfer *int32 `json:"total_data_transfer,omitempty"` + // Uploaded size, as bytes, since the last reset + UsedUploadDataTransfer *int32 `json:"used_upload_data_transfer,omitempty"` + // Downloaded size, as bytes, since the last reset + UsedDownloadDataTransfer *int32 `json:"used_download_data_transfer,omitempty"` + // creation time as unix timestamp in milliseconds. It will be 0 for users created before v2.2.0 + CreatedAt *int64 `json:"created_at,omitempty"` + // last update time as unix timestamp in milliseconds + UpdatedAt *int64 `json:"updated_at,omitempty"` + // Last user login as unix timestamp in milliseconds. It is saved at most once every 10 minutes + LastLogin *int64 `json:"last_login,omitempty"` + Filters *UserFilters `json:"filters,omitempty"` + Filesystem *FilesystemConfig `json:"filesystem,omitempty"` + // Free form text field for external systems + AdditionalInfo *string `json:"additional_info,omitempty"` +} + +// NewUser instantiates a new User object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUser() *User { + this := User{} + return &this +} + +// NewUserWithDefaults instantiates a new User object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserWithDefaults() *User { + this := User{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *User) GetId() int32 { + if o == nil || o.Id == nil { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetIdOk() (*int32, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *User) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *User) SetId(v int32) { + o.Id = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *User) GetStatus() int32 { + if o == nil || o.Status == nil { + var ret int32 + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetStatusOk() (*int32, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *User) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given int32 and assigns it to the Status field. +func (o *User) SetStatus(v int32) { + o.Status = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *User) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *User) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *User) SetUsername(v string) { + o.Username = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *User) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *User) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *User) SetEmail(v string) { + o.Email = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *User) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *User) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *User) SetDescription(v string) { + o.Description = &v +} + +// GetExpirationDate returns the ExpirationDate field value if set, zero value otherwise. +func (o *User) GetExpirationDate() int64 { + if o == nil || o.ExpirationDate == nil { + var ret int64 + return ret + } + return *o.ExpirationDate +} + +// GetExpirationDateOk returns a tuple with the ExpirationDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetExpirationDateOk() (*int64, bool) { + if o == nil || o.ExpirationDate == nil { + return nil, false + } + return o.ExpirationDate, true +} + +// HasExpirationDate returns a boolean if a field has been set. +func (o *User) HasExpirationDate() bool { + if o != nil && o.ExpirationDate != nil { + return true + } + + return false +} + +// SetExpirationDate gets a reference to the given int64 and assigns it to the ExpirationDate field. +func (o *User) SetExpirationDate(v int64) { + o.ExpirationDate = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *User) GetPassword() string { + if o == nil || o.Password == nil { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetPasswordOk() (*string, bool) { + if o == nil || o.Password == nil { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *User) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *User) SetPassword(v string) { + o.Password = &v +} + +// GetPublicKeys returns the PublicKeys field value if set, zero value otherwise. +func (o *User) GetPublicKeys() []string { + if o == nil || o.PublicKeys == nil { + var ret []string + return ret + } + return o.PublicKeys +} + +// GetPublicKeysOk returns a tuple with the PublicKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetPublicKeysOk() ([]string, bool) { + if o == nil || o.PublicKeys == nil { + return nil, false + } + return o.PublicKeys, true +} + +// HasPublicKeys returns a boolean if a field has been set. +func (o *User) HasPublicKeys() bool { + if o != nil && o.PublicKeys != nil { + return true + } + + return false +} + +// SetPublicKeys gets a reference to the given []string and assigns it to the PublicKeys field. +func (o *User) SetPublicKeys(v []string) { + o.PublicKeys = v +} + +// GetHomeDir returns the HomeDir field value if set, zero value otherwise. +func (o *User) GetHomeDir() string { + if o == nil || o.HomeDir == nil { + var ret string + return ret + } + return *o.HomeDir +} + +// GetHomeDirOk returns a tuple with the HomeDir field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetHomeDirOk() (*string, bool) { + if o == nil || o.HomeDir == nil { + return nil, false + } + return o.HomeDir, true +} + +// HasHomeDir returns a boolean if a field has been set. +func (o *User) HasHomeDir() bool { + if o != nil && o.HomeDir != nil { + return true + } + + return false +} + +// SetHomeDir gets a reference to the given string and assigns it to the HomeDir field. +func (o *User) SetHomeDir(v string) { + o.HomeDir = &v +} + +// GetVirtualFolders returns the VirtualFolders field value if set, zero value otherwise. +func (o *User) GetVirtualFolders() []VirtualFolder { + if o == nil || o.VirtualFolders == nil { + var ret []VirtualFolder + return ret + } + return o.VirtualFolders +} + +// GetVirtualFoldersOk returns a tuple with the VirtualFolders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetVirtualFoldersOk() ([]VirtualFolder, bool) { + if o == nil || o.VirtualFolders == nil { + return nil, false + } + return o.VirtualFolders, true +} + +// HasVirtualFolders returns a boolean if a field has been set. +func (o *User) HasVirtualFolders() bool { + if o != nil && o.VirtualFolders != nil { + return true + } + + return false +} + +// SetVirtualFolders gets a reference to the given []VirtualFolder and assigns it to the VirtualFolders field. +func (o *User) SetVirtualFolders(v []VirtualFolder) { + o.VirtualFolders = v +} + +// GetUid returns the Uid field value if set, zero value otherwise. +func (o *User) GetUid() int32 { + if o == nil || o.Uid == nil { + var ret int32 + return ret + } + return *o.Uid +} + +// GetUidOk returns a tuple with the Uid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUidOk() (*int32, bool) { + if o == nil || o.Uid == nil { + return nil, false + } + return o.Uid, true +} + +// HasUid returns a boolean if a field has been set. +func (o *User) HasUid() bool { + if o != nil && o.Uid != nil { + return true + } + + return false +} + +// SetUid gets a reference to the given int32 and assigns it to the Uid field. +func (o *User) SetUid(v int32) { + o.Uid = &v +} + +// GetGid returns the Gid field value if set, zero value otherwise. +func (o *User) GetGid() int32 { + if o == nil || o.Gid == nil { + var ret int32 + return ret + } + return *o.Gid +} + +// GetGidOk returns a tuple with the Gid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetGidOk() (*int32, bool) { + if o == nil || o.Gid == nil { + return nil, false + } + return o.Gid, true +} + +// HasGid returns a boolean if a field has been set. +func (o *User) HasGid() bool { + if o != nil && o.Gid != nil { + return true + } + + return false +} + +// SetGid gets a reference to the given int32 and assigns it to the Gid field. +func (o *User) SetGid(v int32) { + o.Gid = &v +} + +// GetMaxSessions returns the MaxSessions field value if set, zero value otherwise. +func (o *User) GetMaxSessions() int32 { + if o == nil || o.MaxSessions == nil { + var ret int32 + return ret + } + return *o.MaxSessions +} + +// GetMaxSessionsOk returns a tuple with the MaxSessions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetMaxSessionsOk() (*int32, bool) { + if o == nil || o.MaxSessions == nil { + return nil, false + } + return o.MaxSessions, true +} + +// HasMaxSessions returns a boolean if a field has been set. +func (o *User) HasMaxSessions() bool { + if o != nil && o.MaxSessions != nil { + return true + } + + return false +} + +// SetMaxSessions gets a reference to the given int32 and assigns it to the MaxSessions field. +func (o *User) SetMaxSessions(v int32) { + o.MaxSessions = &v +} + +// GetQuotaSize returns the QuotaSize field value if set, zero value otherwise. +func (o *User) GetQuotaSize() int64 { + if o == nil || o.QuotaSize == nil { + var ret int64 + return ret + } + return *o.QuotaSize +} + +// GetQuotaSizeOk returns a tuple with the QuotaSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetQuotaSizeOk() (*int64, bool) { + if o == nil || o.QuotaSize == nil { + return nil, false + } + return o.QuotaSize, true +} + +// HasQuotaSize returns a boolean if a field has been set. +func (o *User) HasQuotaSize() bool { + if o != nil && o.QuotaSize != nil { + return true + } + + return false +} + +// SetQuotaSize gets a reference to the given int64 and assigns it to the QuotaSize field. +func (o *User) SetQuotaSize(v int64) { + o.QuotaSize = &v +} + +// GetQuotaFiles returns the QuotaFiles field value if set, zero value otherwise. +func (o *User) GetQuotaFiles() int32 { + if o == nil || o.QuotaFiles == nil { + var ret int32 + return ret + } + return *o.QuotaFiles +} + +// GetQuotaFilesOk returns a tuple with the QuotaFiles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetQuotaFilesOk() (*int32, bool) { + if o == nil || o.QuotaFiles == nil { + return nil, false + } + return o.QuotaFiles, true +} + +// HasQuotaFiles returns a boolean if a field has been set. +func (o *User) HasQuotaFiles() bool { + if o != nil && o.QuotaFiles != nil { + return true + } + + return false +} + +// SetQuotaFiles gets a reference to the given int32 and assigns it to the QuotaFiles field. +func (o *User) SetQuotaFiles(v int32) { + o.QuotaFiles = &v +} + +// GetPermissions returns the Permissions field value if set, zero value otherwise. +func (o *User) GetPermissions() map[string][]Permission { + if o == nil || o.Permissions == nil { + var ret map[string][]Permission + return ret + } + return o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetPermissionsOk() (map[string][]Permission, bool) { + if o == nil || o.Permissions == nil { + return nil, false + } + return o.Permissions, true +} + +// HasPermissions returns a boolean if a field has been set. +func (o *User) HasPermissions() bool { + if o != nil && o.Permissions != nil { + return true + } + + return false +} + +// SetPermissions gets a reference to the given []map[string][]Permission and assigns it to the Permissions field. +func (o *User) SetPermissions(v map[string][]Permission) { + o.Permissions = v +} + +// GetUsedQuotaSize returns the UsedQuotaSize field value if set, zero value otherwise. +func (o *User) GetUsedQuotaSize() int64 { + if o == nil || o.UsedQuotaSize == nil { + var ret int64 + return ret + } + return *o.UsedQuotaSize +} + +// GetUsedQuotaSizeOk returns a tuple with the UsedQuotaSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUsedQuotaSizeOk() (*int64, bool) { + if o == nil || o.UsedQuotaSize == nil { + return nil, false + } + return o.UsedQuotaSize, true +} + +// HasUsedQuotaSize returns a boolean if a field has been set. +func (o *User) HasUsedQuotaSize() bool { + if o != nil && o.UsedQuotaSize != nil { + return true + } + + return false +} + +// SetUsedQuotaSize gets a reference to the given int64 and assigns it to the UsedQuotaSize field. +func (o *User) SetUsedQuotaSize(v int64) { + o.UsedQuotaSize = &v +} + +// GetUsedQuotaFiles returns the UsedQuotaFiles field value if set, zero value otherwise. +func (o *User) GetUsedQuotaFiles() int32 { + if o == nil || o.UsedQuotaFiles == nil { + var ret int32 + return ret + } + return *o.UsedQuotaFiles +} + +// GetUsedQuotaFilesOk returns a tuple with the UsedQuotaFiles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUsedQuotaFilesOk() (*int32, bool) { + if o == nil || o.UsedQuotaFiles == nil { + return nil, false + } + return o.UsedQuotaFiles, true +} + +// HasUsedQuotaFiles returns a boolean if a field has been set. +func (o *User) HasUsedQuotaFiles() bool { + if o != nil && o.UsedQuotaFiles != nil { + return true + } + + return false +} + +// SetUsedQuotaFiles gets a reference to the given int32 and assigns it to the UsedQuotaFiles field. +func (o *User) SetUsedQuotaFiles(v int32) { + o.UsedQuotaFiles = &v +} + +// GetLastQuotaUpdate returns the LastQuotaUpdate field value if set, zero value otherwise. +func (o *User) GetLastQuotaUpdate() int64 { + if o == nil || o.LastQuotaUpdate == nil { + var ret int64 + return ret + } + return *o.LastQuotaUpdate +} + +// GetLastQuotaUpdateOk returns a tuple with the LastQuotaUpdate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetLastQuotaUpdateOk() (*int64, bool) { + if o == nil || o.LastQuotaUpdate == nil { + return nil, false + } + return o.LastQuotaUpdate, true +} + +// HasLastQuotaUpdate returns a boolean if a field has been set. +func (o *User) HasLastQuotaUpdate() bool { + if o != nil && o.LastQuotaUpdate != nil { + return true + } + + return false +} + +// SetLastQuotaUpdate gets a reference to the given int64 and assigns it to the LastQuotaUpdate field. +func (o *User) SetLastQuotaUpdate(v int64) { + o.LastQuotaUpdate = &v +} + +// GetUploadBandwidth returns the UploadBandwidth field value if set, zero value otherwise. +func (o *User) GetUploadBandwidth() int32 { + if o == nil || o.UploadBandwidth == nil { + var ret int32 + return ret + } + return *o.UploadBandwidth +} + +// GetUploadBandwidthOk returns a tuple with the UploadBandwidth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUploadBandwidthOk() (*int32, bool) { + if o == nil || o.UploadBandwidth == nil { + return nil, false + } + return o.UploadBandwidth, true +} + +// HasUploadBandwidth returns a boolean if a field has been set. +func (o *User) HasUploadBandwidth() bool { + if o != nil && o.UploadBandwidth != nil { + return true + } + + return false +} + +// SetUploadBandwidth gets a reference to the given int32 and assigns it to the UploadBandwidth field. +func (o *User) SetUploadBandwidth(v int32) { + o.UploadBandwidth = &v +} + +// GetDownloadBandwidth returns the DownloadBandwidth field value if set, zero value otherwise. +func (o *User) GetDownloadBandwidth() int32 { + if o == nil || o.DownloadBandwidth == nil { + var ret int32 + return ret + } + return *o.DownloadBandwidth +} + +// GetDownloadBandwidthOk returns a tuple with the DownloadBandwidth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetDownloadBandwidthOk() (*int32, bool) { + if o == nil || o.DownloadBandwidth == nil { + return nil, false + } + return o.DownloadBandwidth, true +} + +// HasDownloadBandwidth returns a boolean if a field has been set. +func (o *User) HasDownloadBandwidth() bool { + if o != nil && o.DownloadBandwidth != nil { + return true + } + + return false +} + +// SetDownloadBandwidth gets a reference to the given int32 and assigns it to the DownloadBandwidth field. +func (o *User) SetDownloadBandwidth(v int32) { + o.DownloadBandwidth = &v +} + +// GetUploadDataTransfer returns the UploadDataTransfer field value if set, zero value otherwise. +func (o *User) GetUploadDataTransfer() int32 { + if o == nil || o.UploadDataTransfer == nil { + var ret int32 + return ret + } + return *o.UploadDataTransfer +} + +// GetUploadDataTransferOk returns a tuple with the UploadDataTransfer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUploadDataTransferOk() (*int32, bool) { + if o == nil || o.UploadDataTransfer == nil { + return nil, false + } + return o.UploadDataTransfer, true +} + +// HasUploadDataTransfer returns a boolean if a field has been set. +func (o *User) HasUploadDataTransfer() bool { + if o != nil && o.UploadDataTransfer != nil { + return true + } + + return false +} + +// SetUploadDataTransfer gets a reference to the given int32 and assigns it to the UploadDataTransfer field. +func (o *User) SetUploadDataTransfer(v int32) { + o.UploadDataTransfer = &v +} + +// GetDownloadDataTransfer returns the DownloadDataTransfer field value if set, zero value otherwise. +func (o *User) GetDownloadDataTransfer() int32 { + if o == nil || o.DownloadDataTransfer == nil { + var ret int32 + return ret + } + return *o.DownloadDataTransfer +} + +// GetDownloadDataTransferOk returns a tuple with the DownloadDataTransfer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetDownloadDataTransferOk() (*int32, bool) { + if o == nil || o.DownloadDataTransfer == nil { + return nil, false + } + return o.DownloadDataTransfer, true +} + +// HasDownloadDataTransfer returns a boolean if a field has been set. +func (o *User) HasDownloadDataTransfer() bool { + if o != nil && o.DownloadDataTransfer != nil { + return true + } + + return false +} + +// SetDownloadDataTransfer gets a reference to the given int32 and assigns it to the DownloadDataTransfer field. +func (o *User) SetDownloadDataTransfer(v int32) { + o.DownloadDataTransfer = &v +} + +// GetTotalDataTransfer returns the TotalDataTransfer field value if set, zero value otherwise. +func (o *User) GetTotalDataTransfer() int32 { + if o == nil || o.TotalDataTransfer == nil { + var ret int32 + return ret + } + return *o.TotalDataTransfer +} + +// GetTotalDataTransferOk returns a tuple with the TotalDataTransfer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetTotalDataTransferOk() (*int32, bool) { + if o == nil || o.TotalDataTransfer == nil { + return nil, false + } + return o.TotalDataTransfer, true +} + +// HasTotalDataTransfer returns a boolean if a field has been set. +func (o *User) HasTotalDataTransfer() bool { + if o != nil && o.TotalDataTransfer != nil { + return true + } + + return false +} + +// SetTotalDataTransfer gets a reference to the given int32 and assigns it to the TotalDataTransfer field. +func (o *User) SetTotalDataTransfer(v int32) { + o.TotalDataTransfer = &v +} + +// GetUsedUploadDataTransfer returns the UsedUploadDataTransfer field value if set, zero value otherwise. +func (o *User) GetUsedUploadDataTransfer() int32 { + if o == nil || o.UsedUploadDataTransfer == nil { + var ret int32 + return ret + } + return *o.UsedUploadDataTransfer +} + +// GetUsedUploadDataTransferOk returns a tuple with the UsedUploadDataTransfer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUsedUploadDataTransferOk() (*int32, bool) { + if o == nil || o.UsedUploadDataTransfer == nil { + return nil, false + } + return o.UsedUploadDataTransfer, true +} + +// HasUsedUploadDataTransfer returns a boolean if a field has been set. +func (o *User) HasUsedUploadDataTransfer() bool { + if o != nil && o.UsedUploadDataTransfer != nil { + return true + } + + return false +} + +// SetUsedUploadDataTransfer gets a reference to the given int32 and assigns it to the UsedUploadDataTransfer field. +func (o *User) SetUsedUploadDataTransfer(v int32) { + o.UsedUploadDataTransfer = &v +} + +// GetUsedDownloadDataTransfer returns the UsedDownloadDataTransfer field value if set, zero value otherwise. +func (o *User) GetUsedDownloadDataTransfer() int32 { + if o == nil || o.UsedDownloadDataTransfer == nil { + var ret int32 + return ret + } + return *o.UsedDownloadDataTransfer +} + +// GetUsedDownloadDataTransferOk returns a tuple with the UsedDownloadDataTransfer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUsedDownloadDataTransferOk() (*int32, bool) { + if o == nil || o.UsedDownloadDataTransfer == nil { + return nil, false + } + return o.UsedDownloadDataTransfer, true +} + +// HasUsedDownloadDataTransfer returns a boolean if a field has been set. +func (o *User) HasUsedDownloadDataTransfer() bool { + if o != nil && o.UsedDownloadDataTransfer != nil { + return true + } + + return false +} + +// SetUsedDownloadDataTransfer gets a reference to the given int32 and assigns it to the UsedDownloadDataTransfer field. +func (o *User) SetUsedDownloadDataTransfer(v int32) { + o.UsedDownloadDataTransfer = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *User) GetCreatedAt() int64 { + if o == nil || o.CreatedAt == nil { + var ret int64 + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetCreatedAtOk() (*int64, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *User) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. +func (o *User) SetCreatedAt(v int64) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *User) GetUpdatedAt() int64 { + if o == nil || o.UpdatedAt == nil { + var ret int64 + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUpdatedAtOk() (*int64, bool) { + if o == nil || o.UpdatedAt == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *User) HasUpdatedAt() bool { + if o != nil && o.UpdatedAt != nil { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given int64 and assigns it to the UpdatedAt field. +func (o *User) SetUpdatedAt(v int64) { + o.UpdatedAt = &v +} + +// GetLastLogin returns the LastLogin field value if set, zero value otherwise. +func (o *User) GetLastLogin() int64 { + if o == nil || o.LastLogin == nil { + var ret int64 + return ret + } + return *o.LastLogin +} + +// GetLastLoginOk returns a tuple with the LastLogin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetLastLoginOk() (*int64, bool) { + if o == nil || o.LastLogin == nil { + return nil, false + } + return o.LastLogin, true +} + +// HasLastLogin returns a boolean if a field has been set. +func (o *User) HasLastLogin() bool { + if o != nil && o.LastLogin != nil { + return true + } + + return false +} + +// SetLastLogin gets a reference to the given int64 and assigns it to the LastLogin field. +func (o *User) SetLastLogin(v int64) { + o.LastLogin = &v +} + +// GetFilters returns the Filters field value if set, zero value otherwise. +func (o *User) GetFilters() UserFilters { + if o == nil || o.Filters == nil { + var ret UserFilters + return ret + } + return *o.Filters +} + +// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetFiltersOk() (*UserFilters, bool) { + if o == nil || o.Filters == nil { + return nil, false + } + return o.Filters, true +} + +// HasFilters returns a boolean if a field has been set. +func (o *User) HasFilters() bool { + if o != nil && o.Filters != nil { + return true + } + + return false +} + +// SetFilters gets a reference to the given UserFilters and assigns it to the Filters field. +func (o *User) SetFilters(v UserFilters) { + o.Filters = &v +} + +// GetFilesystem returns the Filesystem field value if set, zero value otherwise. +func (o *User) GetFilesystem() FilesystemConfig { + if o == nil || o.Filesystem == nil { + var ret FilesystemConfig + return ret + } + return *o.Filesystem +} + +// GetFilesystemOk returns a tuple with the Filesystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetFilesystemOk() (*FilesystemConfig, bool) { + if o == nil || o.Filesystem == nil { + return nil, false + } + return o.Filesystem, true +} + +// HasFilesystem returns a boolean if a field has been set. +func (o *User) HasFilesystem() bool { + if o != nil && o.Filesystem != nil { + return true + } + + return false +} + +// SetFilesystem gets a reference to the given FilesystemConfig and assigns it to the Filesystem field. +func (o *User) SetFilesystem(v FilesystemConfig) { + o.Filesystem = &v +} + +// GetAdditionalInfo returns the AdditionalInfo field value if set, zero value otherwise. +func (o *User) GetAdditionalInfo() string { + if o == nil || o.AdditionalInfo == nil { + var ret string + return ret + } + return *o.AdditionalInfo +} + +// GetAdditionalInfoOk returns a tuple with the AdditionalInfo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetAdditionalInfoOk() (*string, bool) { + if o == nil || o.AdditionalInfo == nil { + return nil, false + } + return o.AdditionalInfo, true +} + +// HasAdditionalInfo returns a boolean if a field has been set. +func (o *User) HasAdditionalInfo() bool { + if o != nil && o.AdditionalInfo != nil { + return true + } + + return false +} + +// SetAdditionalInfo gets a reference to the given string and assigns it to the AdditionalInfo field. +func (o *User) SetAdditionalInfo(v string) { + o.AdditionalInfo = &v +} + +func (o User) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.ExpirationDate != nil { + toSerialize["expiration_date"] = o.ExpirationDate + } + if o.Password != nil { + toSerialize["password"] = o.Password + } + if o.PublicKeys != nil { + toSerialize["public_keys"] = o.PublicKeys + } + if o.HomeDir != nil { + toSerialize["home_dir"] = o.HomeDir + } + if o.VirtualFolders != nil { + toSerialize["virtual_folders"] = o.VirtualFolders + } + if o.Uid != nil { + toSerialize["uid"] = o.Uid + } + if o.Gid != nil { + toSerialize["gid"] = o.Gid + } + if o.MaxSessions != nil { + toSerialize["max_sessions"] = o.MaxSessions + } + if o.QuotaSize != nil { + toSerialize["quota_size"] = o.QuotaSize + } + if o.QuotaFiles != nil { + toSerialize["quota_files"] = o.QuotaFiles + } + if o.Permissions != nil { + toSerialize["permissions"] = o.Permissions + } + if o.UsedQuotaSize != nil { + toSerialize["used_quota_size"] = o.UsedQuotaSize + } + if o.UsedQuotaFiles != nil { + toSerialize["used_quota_files"] = o.UsedQuotaFiles + } + if o.LastQuotaUpdate != nil { + toSerialize["last_quota_update"] = o.LastQuotaUpdate + } + if o.UploadBandwidth != nil { + toSerialize["upload_bandwidth"] = o.UploadBandwidth + } + if o.DownloadBandwidth != nil { + toSerialize["download_bandwidth"] = o.DownloadBandwidth + } + if o.UploadDataTransfer != nil { + toSerialize["upload_data_transfer"] = o.UploadDataTransfer + } + if o.DownloadDataTransfer != nil { + toSerialize["download_data_transfer"] = o.DownloadDataTransfer + } + if o.TotalDataTransfer != nil { + toSerialize["total_data_transfer"] = o.TotalDataTransfer + } + if o.UsedUploadDataTransfer != nil { + toSerialize["used_upload_data_transfer"] = o.UsedUploadDataTransfer + } + if o.UsedDownloadDataTransfer != nil { + toSerialize["used_download_data_transfer"] = o.UsedDownloadDataTransfer + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.UpdatedAt != nil { + toSerialize["updated_at"] = o.UpdatedAt + } + if o.LastLogin != nil { + toSerialize["last_login"] = o.LastLogin + } + if o.Filters != nil { + toSerialize["filters"] = o.Filters + } + if o.Filesystem != nil { + toSerialize["filesystem"] = o.Filesystem + } + if o.AdditionalInfo != nil { + toSerialize["additional_info"] = o.AdditionalInfo + } + return json.Marshal(toSerialize) +} + +type NullableUser struct { + value *User + isSet bool +} + +func (v NullableUser) Get() *User { + return v.value +} + +func (v *NullableUser) Set(val *User) { + v.value = val + v.isSet = true +} + +func (v NullableUser) IsSet() bool { + return v.isSet +} + +func (v *NullableUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUser(val *User) *NullableUser { + return &NullableUser{value: val, isSet: true} +} + +func (v NullableUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_user_filters.go b/server/common/sftpgo/v2/openapi/model_user_filters.go new file mode 100644 index 00000000..b070ac05 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_user_filters.go @@ -0,0 +1,665 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// UserFilters Additional user options +type UserFilters struct { + // only clients connecting from these IP/Mask are allowed. IP/Mask must be in CIDR notation as defined in RFC 4632 and RFC 4291, for example \"192.0.2.0/24\" or \"2001:db8::/32\" + AllowedIp []string `json:"allowed_ip,omitempty"` + // clients connecting from these IP/Mask are not allowed. Denied rules are evaluated before allowed ones + DeniedIp []string `json:"denied_ip,omitempty"` + // if null or empty any available login method is allowed + DeniedLoginMethods []LoginMethods `json:"denied_login_methods,omitempty"` + // if null or empty any available protocol is allowed + DeniedProtocols []SupportedProtocols `json:"denied_protocols,omitempty"` + // filters based on shell like file patterns. These restrictions do not apply to files listing for performance reasons, so a denied file cannot be downloaded/overwritten/renamed but it will still be in the list of files. Please note that these restrictions can be easily bypassed + FilePatterns []PatternsFilter `json:"file_patterns,omitempty"` + // maximum allowed size, as bytes, for a single file upload. The upload will be aborted if/when the size of the file being sent exceeds this limit. 0 means unlimited. This restriction does not apply for SSH system commands such as `git` and `rsync` + MaxUploadFileSize *int64 `json:"max_upload_file_size,omitempty"` + // defines the TLS certificate field to use as username. For FTP clients it must match the name provided using the \"USER\" command. For WebDAV, if no username is provided, the CN will be used as username. For WebDAV clients it must match the implicit or provided username. Ignored if mutual TLS is disabled + TlsUsername *string `json:"tls_username,omitempty"` + Hooks *HooksFilter `json:"hooks,omitempty"` + // Disable checks for existence and automatic creation of home directory and virtual folders. SFTPGo requires that the user's home directory, virtual folder root, and intermediate paths to virtual folders exist to work properly. If you already know that the required directories exist, disabling these checks will speed up login. You could, for example, disable these checks after the first login + DisableFsChecks *bool `json:"disable_fs_checks,omitempty"` + // WebClient/user REST API related configuration options + WebClient []WebClientOptions `json:"web_client,omitempty"` + // API key authentication allows to impersonate this user with an API key + AllowApiKeyAuth *bool `json:"allow_api_key_auth,omitempty"` + UserType *UserType `json:"user_type,omitempty"` + TotpConfig *UserTOTPConfig `json:"totp_config,omitempty"` + RecoveryCodes []RecoveryCode `json:"recovery_codes,omitempty"` + BandwidthLimits []BandwidthLimit `json:"bandwidth_limits,omitempty"` + DataTransferLimits []DataTransferLimit `json:"data_transfer_limits,omitempty"` +} + +// NewUserFilters instantiates a new UserFilters object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserFilters() *UserFilters { + this := UserFilters{} + return &this +} + +// NewUserFiltersWithDefaults instantiates a new UserFilters object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserFiltersWithDefaults() *UserFilters { + this := UserFilters{} + return &this +} + +// GetAllowedIp returns the AllowedIp field value if set, zero value otherwise. +func (o *UserFilters) GetAllowedIp() []string { + if o == nil || o.AllowedIp == nil { + var ret []string + return ret + } + return o.AllowedIp +} + +// GetAllowedIpOk returns a tuple with the AllowedIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetAllowedIpOk() ([]string, bool) { + if o == nil || o.AllowedIp == nil { + return nil, false + } + return o.AllowedIp, true +} + +// HasAllowedIp returns a boolean if a field has been set. +func (o *UserFilters) HasAllowedIp() bool { + if o != nil && o.AllowedIp != nil { + return true + } + + return false +} + +// SetAllowedIp gets a reference to the given []string and assigns it to the AllowedIp field. +func (o *UserFilters) SetAllowedIp(v []string) { + o.AllowedIp = v +} + +// GetDeniedIp returns the DeniedIp field value if set, zero value otherwise. +func (o *UserFilters) GetDeniedIp() []string { + if o == nil || o.DeniedIp == nil { + var ret []string + return ret + } + return o.DeniedIp +} + +// GetDeniedIpOk returns a tuple with the DeniedIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetDeniedIpOk() ([]string, bool) { + if o == nil || o.DeniedIp == nil { + return nil, false + } + return o.DeniedIp, true +} + +// HasDeniedIp returns a boolean if a field has been set. +func (o *UserFilters) HasDeniedIp() bool { + if o != nil && o.DeniedIp != nil { + return true + } + + return false +} + +// SetDeniedIp gets a reference to the given []string and assigns it to the DeniedIp field. +func (o *UserFilters) SetDeniedIp(v []string) { + o.DeniedIp = v +} + +// GetDeniedLoginMethods returns the DeniedLoginMethods field value if set, zero value otherwise. +func (o *UserFilters) GetDeniedLoginMethods() []LoginMethods { + if o == nil || o.DeniedLoginMethods == nil { + var ret []LoginMethods + return ret + } + return o.DeniedLoginMethods +} + +// GetDeniedLoginMethodsOk returns a tuple with the DeniedLoginMethods field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetDeniedLoginMethodsOk() ([]LoginMethods, bool) { + if o == nil || o.DeniedLoginMethods == nil { + return nil, false + } + return o.DeniedLoginMethods, true +} + +// HasDeniedLoginMethods returns a boolean if a field has been set. +func (o *UserFilters) HasDeniedLoginMethods() bool { + if o != nil && o.DeniedLoginMethods != nil { + return true + } + + return false +} + +// SetDeniedLoginMethods gets a reference to the given []LoginMethods and assigns it to the DeniedLoginMethods field. +func (o *UserFilters) SetDeniedLoginMethods(v []LoginMethods) { + o.DeniedLoginMethods = v +} + +// GetDeniedProtocols returns the DeniedProtocols field value if set, zero value otherwise. +func (o *UserFilters) GetDeniedProtocols() []SupportedProtocols { + if o == nil || o.DeniedProtocols == nil { + var ret []SupportedProtocols + return ret + } + return o.DeniedProtocols +} + +// GetDeniedProtocolsOk returns a tuple with the DeniedProtocols field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetDeniedProtocolsOk() ([]SupportedProtocols, bool) { + if o == nil || o.DeniedProtocols == nil { + return nil, false + } + return o.DeniedProtocols, true +} + +// HasDeniedProtocols returns a boolean if a field has been set. +func (o *UserFilters) HasDeniedProtocols() bool { + if o != nil && o.DeniedProtocols != nil { + return true + } + + return false +} + +// SetDeniedProtocols gets a reference to the given []SupportedProtocols and assigns it to the DeniedProtocols field. +func (o *UserFilters) SetDeniedProtocols(v []SupportedProtocols) { + o.DeniedProtocols = v +} + +// GetFilePatterns returns the FilePatterns field value if set, zero value otherwise. +func (o *UserFilters) GetFilePatterns() []PatternsFilter { + if o == nil || o.FilePatterns == nil { + var ret []PatternsFilter + return ret + } + return o.FilePatterns +} + +// GetFilePatternsOk returns a tuple with the FilePatterns field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetFilePatternsOk() ([]PatternsFilter, bool) { + if o == nil || o.FilePatterns == nil { + return nil, false + } + return o.FilePatterns, true +} + +// HasFilePatterns returns a boolean if a field has been set. +func (o *UserFilters) HasFilePatterns() bool { + if o != nil && o.FilePatterns != nil { + return true + } + + return false +} + +// SetFilePatterns gets a reference to the given []PatternsFilter and assigns it to the FilePatterns field. +func (o *UserFilters) SetFilePatterns(v []PatternsFilter) { + o.FilePatterns = v +} + +// GetMaxUploadFileSize returns the MaxUploadFileSize field value if set, zero value otherwise. +func (o *UserFilters) GetMaxUploadFileSize() int64 { + if o == nil || o.MaxUploadFileSize == nil { + var ret int64 + return ret + } + return *o.MaxUploadFileSize +} + +// GetMaxUploadFileSizeOk returns a tuple with the MaxUploadFileSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetMaxUploadFileSizeOk() (*int64, bool) { + if o == nil || o.MaxUploadFileSize == nil { + return nil, false + } + return o.MaxUploadFileSize, true +} + +// HasMaxUploadFileSize returns a boolean if a field has been set. +func (o *UserFilters) HasMaxUploadFileSize() bool { + if o != nil && o.MaxUploadFileSize != nil { + return true + } + + return false +} + +// SetMaxUploadFileSize gets a reference to the given int64 and assigns it to the MaxUploadFileSize field. +func (o *UserFilters) SetMaxUploadFileSize(v int64) { + o.MaxUploadFileSize = &v +} + +// GetTlsUsername returns the TlsUsername field value if set, zero value otherwise. +func (o *UserFilters) GetTlsUsername() string { + if o == nil || o.TlsUsername == nil { + var ret string + return ret + } + return *o.TlsUsername +} + +// GetTlsUsernameOk returns a tuple with the TlsUsername field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetTlsUsernameOk() (*string, bool) { + if o == nil || o.TlsUsername == nil { + return nil, false + } + return o.TlsUsername, true +} + +// HasTlsUsername returns a boolean if a field has been set. +func (o *UserFilters) HasTlsUsername() bool { + if o != nil && o.TlsUsername != nil { + return true + } + + return false +} + +// SetTlsUsername gets a reference to the given string and assigns it to the TlsUsername field. +func (o *UserFilters) SetTlsUsername(v string) { + o.TlsUsername = &v +} + +// GetHooks returns the Hooks field value if set, zero value otherwise. +func (o *UserFilters) GetHooks() HooksFilter { + if o == nil || o.Hooks == nil { + var ret HooksFilter + return ret + } + return *o.Hooks +} + +// GetHooksOk returns a tuple with the Hooks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetHooksOk() (*HooksFilter, bool) { + if o == nil || o.Hooks == nil { + return nil, false + } + return o.Hooks, true +} + +// HasHooks returns a boolean if a field has been set. +func (o *UserFilters) HasHooks() bool { + if o != nil && o.Hooks != nil { + return true + } + + return false +} + +// SetHooks gets a reference to the given HooksFilter and assigns it to the Hooks field. +func (o *UserFilters) SetHooks(v HooksFilter) { + o.Hooks = &v +} + +// GetDisableFsChecks returns the DisableFsChecks field value if set, zero value otherwise. +func (o *UserFilters) GetDisableFsChecks() bool { + if o == nil || o.DisableFsChecks == nil { + var ret bool + return ret + } + return *o.DisableFsChecks +} + +// GetDisableFsChecksOk returns a tuple with the DisableFsChecks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetDisableFsChecksOk() (*bool, bool) { + if o == nil || o.DisableFsChecks == nil { + return nil, false + } + return o.DisableFsChecks, true +} + +// HasDisableFsChecks returns a boolean if a field has been set. +func (o *UserFilters) HasDisableFsChecks() bool { + if o != nil && o.DisableFsChecks != nil { + return true + } + + return false +} + +// SetDisableFsChecks gets a reference to the given bool and assigns it to the DisableFsChecks field. +func (o *UserFilters) SetDisableFsChecks(v bool) { + o.DisableFsChecks = &v +} + +// GetWebClient returns the WebClient field value if set, zero value otherwise. +func (o *UserFilters) GetWebClient() []WebClientOptions { + if o == nil || o.WebClient == nil { + var ret []WebClientOptions + return ret + } + return o.WebClient +} + +// GetWebClientOk returns a tuple with the WebClient field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetWebClientOk() ([]WebClientOptions, bool) { + if o == nil || o.WebClient == nil { + return nil, false + } + return o.WebClient, true +} + +// HasWebClient returns a boolean if a field has been set. +func (o *UserFilters) HasWebClient() bool { + if o != nil && o.WebClient != nil { + return true + } + + return false +} + +// SetWebClient gets a reference to the given []WebClientOptions and assigns it to the WebClient field. +func (o *UserFilters) SetWebClient(v []WebClientOptions) { + o.WebClient = v +} + +// GetAllowApiKeyAuth returns the AllowApiKeyAuth field value if set, zero value otherwise. +func (o *UserFilters) GetAllowApiKeyAuth() bool { + if o == nil || o.AllowApiKeyAuth == nil { + var ret bool + return ret + } + return *o.AllowApiKeyAuth +} + +// GetAllowApiKeyAuthOk returns a tuple with the AllowApiKeyAuth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetAllowApiKeyAuthOk() (*bool, bool) { + if o == nil || o.AllowApiKeyAuth == nil { + return nil, false + } + return o.AllowApiKeyAuth, true +} + +// HasAllowApiKeyAuth returns a boolean if a field has been set. +func (o *UserFilters) HasAllowApiKeyAuth() bool { + if o != nil && o.AllowApiKeyAuth != nil { + return true + } + + return false +} + +// SetAllowApiKeyAuth gets a reference to the given bool and assigns it to the AllowApiKeyAuth field. +func (o *UserFilters) SetAllowApiKeyAuth(v bool) { + o.AllowApiKeyAuth = &v +} + +// GetUserType returns the UserType field value if set, zero value otherwise. +func (o *UserFilters) GetUserType() UserType { + if o == nil || o.UserType == nil { + var ret UserType + return ret + } + return *o.UserType +} + +// GetUserTypeOk returns a tuple with the UserType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetUserTypeOk() (*UserType, bool) { + if o == nil || o.UserType == nil { + return nil, false + } + return o.UserType, true +} + +// HasUserType returns a boolean if a field has been set. +func (o *UserFilters) HasUserType() bool { + if o != nil && o.UserType != nil { + return true + } + + return false +} + +// SetUserType gets a reference to the given UserType and assigns it to the UserType field. +func (o *UserFilters) SetUserType(v UserType) { + o.UserType = &v +} + +// GetTotpConfig returns the TotpConfig field value if set, zero value otherwise. +func (o *UserFilters) GetTotpConfig() UserTOTPConfig { + if o == nil || o.TotpConfig == nil { + var ret UserTOTPConfig + return ret + } + return *o.TotpConfig +} + +// GetTotpConfigOk returns a tuple with the TotpConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetTotpConfigOk() (*UserTOTPConfig, bool) { + if o == nil || o.TotpConfig == nil { + return nil, false + } + return o.TotpConfig, true +} + +// HasTotpConfig returns a boolean if a field has been set. +func (o *UserFilters) HasTotpConfig() bool { + if o != nil && o.TotpConfig != nil { + return true + } + + return false +} + +// SetTotpConfig gets a reference to the given UserTOTPConfig and assigns it to the TotpConfig field. +func (o *UserFilters) SetTotpConfig(v UserTOTPConfig) { + o.TotpConfig = &v +} + +// GetRecoveryCodes returns the RecoveryCodes field value if set, zero value otherwise. +func (o *UserFilters) GetRecoveryCodes() []RecoveryCode { + if o == nil || o.RecoveryCodes == nil { + var ret []RecoveryCode + return ret + } + return o.RecoveryCodes +} + +// GetRecoveryCodesOk returns a tuple with the RecoveryCodes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetRecoveryCodesOk() ([]RecoveryCode, bool) { + if o == nil || o.RecoveryCodes == nil { + return nil, false + } + return o.RecoveryCodes, true +} + +// HasRecoveryCodes returns a boolean if a field has been set. +func (o *UserFilters) HasRecoveryCodes() bool { + if o != nil && o.RecoveryCodes != nil { + return true + } + + return false +} + +// SetRecoveryCodes gets a reference to the given []RecoveryCode and assigns it to the RecoveryCodes field. +func (o *UserFilters) SetRecoveryCodes(v []RecoveryCode) { + o.RecoveryCodes = v +} + +// GetBandwidthLimits returns the BandwidthLimits field value if set, zero value otherwise. +func (o *UserFilters) GetBandwidthLimits() []BandwidthLimit { + if o == nil || o.BandwidthLimits == nil { + var ret []BandwidthLimit + return ret + } + return o.BandwidthLimits +} + +// GetBandwidthLimitsOk returns a tuple with the BandwidthLimits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetBandwidthLimitsOk() ([]BandwidthLimit, bool) { + if o == nil || o.BandwidthLimits == nil { + return nil, false + } + return o.BandwidthLimits, true +} + +// HasBandwidthLimits returns a boolean if a field has been set. +func (o *UserFilters) HasBandwidthLimits() bool { + if o != nil && o.BandwidthLimits != nil { + return true + } + + return false +} + +// SetBandwidthLimits gets a reference to the given []BandwidthLimit and assigns it to the BandwidthLimits field. +func (o *UserFilters) SetBandwidthLimits(v []BandwidthLimit) { + o.BandwidthLimits = v +} + +// GetDataTransferLimits returns the DataTransferLimits field value if set, zero value otherwise. +func (o *UserFilters) GetDataTransferLimits() []DataTransferLimit { + if o == nil || o.DataTransferLimits == nil { + var ret []DataTransferLimit + return ret + } + return o.DataTransferLimits +} + +// GetDataTransferLimitsOk returns a tuple with the DataTransferLimits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserFilters) GetDataTransferLimitsOk() ([]DataTransferLimit, bool) { + if o == nil || o.DataTransferLimits == nil { + return nil, false + } + return o.DataTransferLimits, true +} + +// HasDataTransferLimits returns a boolean if a field has been set. +func (o *UserFilters) HasDataTransferLimits() bool { + if o != nil && o.DataTransferLimits != nil { + return true + } + + return false +} + +// SetDataTransferLimits gets a reference to the given []DataTransferLimit and assigns it to the DataTransferLimits field. +func (o *UserFilters) SetDataTransferLimits(v []DataTransferLimit) { + o.DataTransferLimits = v +} + +func (o UserFilters) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.AllowedIp != nil { + toSerialize["allowed_ip"] = o.AllowedIp + } + if o.DeniedIp != nil { + toSerialize["denied_ip"] = o.DeniedIp + } + if o.DeniedLoginMethods != nil { + toSerialize["denied_login_methods"] = o.DeniedLoginMethods + } + if o.DeniedProtocols != nil { + toSerialize["denied_protocols"] = o.DeniedProtocols + } + if o.FilePatterns != nil { + toSerialize["file_patterns"] = o.FilePatterns + } + if o.MaxUploadFileSize != nil { + toSerialize["max_upload_file_size"] = o.MaxUploadFileSize + } + if o.TlsUsername != nil { + toSerialize["tls_username"] = o.TlsUsername + } + if o.Hooks != nil { + toSerialize["hooks"] = o.Hooks + } + if o.DisableFsChecks != nil { + toSerialize["disable_fs_checks"] = o.DisableFsChecks + } + if o.WebClient != nil { + toSerialize["web_client"] = o.WebClient + } + if o.AllowApiKeyAuth != nil { + toSerialize["allow_api_key_auth"] = o.AllowApiKeyAuth + } + if o.UserType != nil { + toSerialize["user_type"] = o.UserType + } + if o.TotpConfig != nil { + toSerialize["totp_config"] = o.TotpConfig + } + if o.RecoveryCodes != nil { + toSerialize["recovery_codes"] = o.RecoveryCodes + } + if o.BandwidthLimits != nil { + toSerialize["bandwidth_limits"] = o.BandwidthLimits + } + if o.DataTransferLimits != nil { + toSerialize["data_transfer_limits"] = o.DataTransferLimits + } + return json.Marshal(toSerialize) +} + +type NullableUserFilters struct { + value *UserFilters + isSet bool +} + +func (v NullableUserFilters) Get() *UserFilters { + return v.value +} + +func (v *NullableUserFilters) Set(val *UserFilters) { + v.value = val + v.isSet = true +} + +func (v NullableUserFilters) IsSet() bool { + return v.isSet +} + +func (v *NullableUserFilters) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserFilters(val *UserFilters) *NullableUserFilters { + return &NullableUserFilters{value: val, isSet: true} +} + +func (v NullableUserFilters) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserFilters) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_user_profile.go b/server/common/sftpgo/v2/openapi/model_user_profile.go new file mode 100644 index 00000000..4aef3361 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_user_profile.go @@ -0,0 +1,224 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// UserProfile struct for UserProfile +type UserProfile struct { + Email *string `json:"email,omitempty"` + Description *string `json:"description,omitempty"` + // If enabled, you can impersonate this user, in REST API, using an API key. If disabled user credentials are required for impersonation + AllowApiKeyAuth *bool `json:"allow_api_key_auth,omitempty"` + PublicKeys []string `json:"public_keys,omitempty"` +} + +// NewUserProfile instantiates a new UserProfile object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserProfile() *UserProfile { + this := UserProfile{} + return &this +} + +// NewUserProfileWithDefaults instantiates a new UserProfile object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserProfileWithDefaults() *UserProfile { + this := UserProfile{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *UserProfile) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserProfile) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *UserProfile) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *UserProfile) SetEmail(v string) { + o.Email = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UserProfile) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserProfile) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *UserProfile) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UserProfile) SetDescription(v string) { + o.Description = &v +} + +// GetAllowApiKeyAuth returns the AllowApiKeyAuth field value if set, zero value otherwise. +func (o *UserProfile) GetAllowApiKeyAuth() bool { + if o == nil || o.AllowApiKeyAuth == nil { + var ret bool + return ret + } + return *o.AllowApiKeyAuth +} + +// GetAllowApiKeyAuthOk returns a tuple with the AllowApiKeyAuth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserProfile) GetAllowApiKeyAuthOk() (*bool, bool) { + if o == nil || o.AllowApiKeyAuth == nil { + return nil, false + } + return o.AllowApiKeyAuth, true +} + +// HasAllowApiKeyAuth returns a boolean if a field has been set. +func (o *UserProfile) HasAllowApiKeyAuth() bool { + if o != nil && o.AllowApiKeyAuth != nil { + return true + } + + return false +} + +// SetAllowApiKeyAuth gets a reference to the given bool and assigns it to the AllowApiKeyAuth field. +func (o *UserProfile) SetAllowApiKeyAuth(v bool) { + o.AllowApiKeyAuth = &v +} + +// GetPublicKeys returns the PublicKeys field value if set, zero value otherwise. +func (o *UserProfile) GetPublicKeys() []string { + if o == nil || o.PublicKeys == nil { + var ret []string + return ret + } + return o.PublicKeys +} + +// GetPublicKeysOk returns a tuple with the PublicKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserProfile) GetPublicKeysOk() ([]string, bool) { + if o == nil || o.PublicKeys == nil { + return nil, false + } + return o.PublicKeys, true +} + +// HasPublicKeys returns a boolean if a field has been set. +func (o *UserProfile) HasPublicKeys() bool { + if o != nil && o.PublicKeys != nil { + return true + } + + return false +} + +// SetPublicKeys gets a reference to the given []string and assigns it to the PublicKeys field. +func (o *UserProfile) SetPublicKeys(v []string) { + o.PublicKeys = v +} + +func (o UserProfile) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.AllowApiKeyAuth != nil { + toSerialize["allow_api_key_auth"] = o.AllowApiKeyAuth + } + if o.PublicKeys != nil { + toSerialize["public_keys"] = o.PublicKeys + } + return json.Marshal(toSerialize) +} + +type NullableUserProfile struct { + value *UserProfile + isSet bool +} + +func (v NullableUserProfile) Get() *UserProfile { + return v.value +} + +func (v *NullableUserProfile) Set(val *UserProfile) { + v.value = val + v.isSet = true +} + +func (v NullableUserProfile) IsSet() bool { + return v.isSet +} + +func (v *NullableUserProfile) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserProfile(val *UserProfile) *NullableUserProfile { + return &NullableUserProfile{value: val, isSet: true} +} + +func (v NullableUserProfile) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserProfile) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_user_totp_config.go b/server/common/sftpgo/v2/openapi/model_user_totp_config.go new file mode 100644 index 00000000..7a9828b4 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_user_totp_config.go @@ -0,0 +1,225 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// UserTOTPConfig struct for UserTOTPConfig +type UserTOTPConfig struct { + Enabled *bool `json:"enabled,omitempty"` + // This name must be defined within the \"totp\" section of the SFTPGo configuration file. You will be unable to save a user/admin referencing a missing config_name + ConfigName *string `json:"config_name,omitempty"` + Secret *Secret `json:"secret,omitempty"` + // TOTP will be required for the specified protocols. SSH protocol (SFTP/SCP/SSH commands) will ask for the TOTP passcode if the client uses keyboard interactive authentication. FTP has no standard way to support two factor authentication, if you enable the FTP support, you have to add the TOTP passcode after the password. For example if your password is \"password\" and your one time passcode is \"123456\" you have to use \"password123456\" as password. WebDAV is not supported since each single request must be authenticated and a passcode cannot be reused. + Protocols []MFAProtocols `json:"protocols,omitempty"` +} + +// NewUserTOTPConfig instantiates a new UserTOTPConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserTOTPConfig() *UserTOTPConfig { + this := UserTOTPConfig{} + return &this +} + +// NewUserTOTPConfigWithDefaults instantiates a new UserTOTPConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserTOTPConfigWithDefaults() *UserTOTPConfig { + this := UserTOTPConfig{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *UserTOTPConfig) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserTOTPConfig) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *UserTOTPConfig) HasEnabled() bool { + if o != nil && o.Enabled != nil { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *UserTOTPConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetConfigName returns the ConfigName field value if set, zero value otherwise. +func (o *UserTOTPConfig) GetConfigName() string { + if o == nil || o.ConfigName == nil { + var ret string + return ret + } + return *o.ConfigName +} + +// GetConfigNameOk returns a tuple with the ConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserTOTPConfig) GetConfigNameOk() (*string, bool) { + if o == nil || o.ConfigName == nil { + return nil, false + } + return o.ConfigName, true +} + +// HasConfigName returns a boolean if a field has been set. +func (o *UserTOTPConfig) HasConfigName() bool { + if o != nil && o.ConfigName != nil { + return true + } + + return false +} + +// SetConfigName gets a reference to the given string and assigns it to the ConfigName field. +func (o *UserTOTPConfig) SetConfigName(v string) { + o.ConfigName = &v +} + +// GetSecret returns the Secret field value if set, zero value otherwise. +func (o *UserTOTPConfig) GetSecret() Secret { + if o == nil || o.Secret == nil { + var ret Secret + return ret + } + return *o.Secret +} + +// GetSecretOk returns a tuple with the Secret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserTOTPConfig) GetSecretOk() (*Secret, bool) { + if o == nil || o.Secret == nil { + return nil, false + } + return o.Secret, true +} + +// HasSecret returns a boolean if a field has been set. +func (o *UserTOTPConfig) HasSecret() bool { + if o != nil && o.Secret != nil { + return true + } + + return false +} + +// SetSecret gets a reference to the given Secret and assigns it to the Secret field. +func (o *UserTOTPConfig) SetSecret(v Secret) { + o.Secret = &v +} + +// GetProtocols returns the Protocols field value if set, zero value otherwise. +func (o *UserTOTPConfig) GetProtocols() []MFAProtocols { + if o == nil || o.Protocols == nil { + var ret []MFAProtocols + return ret + } + return o.Protocols +} + +// GetProtocolsOk returns a tuple with the Protocols field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserTOTPConfig) GetProtocolsOk() ([]MFAProtocols, bool) { + if o == nil || o.Protocols == nil { + return nil, false + } + return o.Protocols, true +} + +// HasProtocols returns a boolean if a field has been set. +func (o *UserTOTPConfig) HasProtocols() bool { + if o != nil && o.Protocols != nil { + return true + } + + return false +} + +// SetProtocols gets a reference to the given []MFAProtocols and assigns it to the Protocols field. +func (o *UserTOTPConfig) SetProtocols(v []MFAProtocols) { + o.Protocols = v +} + +func (o UserTOTPConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.ConfigName != nil { + toSerialize["config_name"] = o.ConfigName + } + if o.Secret != nil { + toSerialize["secret"] = o.Secret + } + if o.Protocols != nil { + toSerialize["protocols"] = o.Protocols + } + return json.Marshal(toSerialize) +} + +type NullableUserTOTPConfig struct { + value *UserTOTPConfig + isSet bool +} + +func (v NullableUserTOTPConfig) Get() *UserTOTPConfig { + return v.value +} + +func (v *NullableUserTOTPConfig) Set(val *UserTOTPConfig) { + v.value = val + v.isSet = true +} + +func (v NullableUserTOTPConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableUserTOTPConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserTOTPConfig(val *UserTOTPConfig) *NullableUserTOTPConfig { + return &NullableUserTOTPConfig{value: val, isSet: true} +} + +func (v NullableUserTOTPConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserTOTPConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_user_totp_config_all_of.go b/server/common/sftpgo/v2/openapi/model_user_totp_config_all_of.go new file mode 100644 index 00000000..0929e772 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_user_totp_config_all_of.go @@ -0,0 +1,116 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// UserTOTPConfigAllOf struct for UserTOTPConfigAllOf +type UserTOTPConfigAllOf struct { + // TOTP will be required for the specified protocols. SSH protocol (SFTP/SCP/SSH commands) will ask for the TOTP passcode if the client uses keyboard interactive authentication. FTP has no standard way to support two factor authentication, if you enable the FTP support, you have to add the TOTP passcode after the password. For example if your password is \"password\" and your one time passcode is \"123456\" you have to use \"password123456\" as password. WebDAV is not supported since each single request must be authenticated and a passcode cannot be reused. + Protocols []MFAProtocols `json:"protocols,omitempty"` +} + +// NewUserTOTPConfigAllOf instantiates a new UserTOTPConfigAllOf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserTOTPConfigAllOf() *UserTOTPConfigAllOf { + this := UserTOTPConfigAllOf{} + return &this +} + +// NewUserTOTPConfigAllOfWithDefaults instantiates a new UserTOTPConfigAllOf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserTOTPConfigAllOfWithDefaults() *UserTOTPConfigAllOf { + this := UserTOTPConfigAllOf{} + return &this +} + +// GetProtocols returns the Protocols field value if set, zero value otherwise. +func (o *UserTOTPConfigAllOf) GetProtocols() []MFAProtocols { + if o == nil || o.Protocols == nil { + var ret []MFAProtocols + return ret + } + return o.Protocols +} + +// GetProtocolsOk returns a tuple with the Protocols field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserTOTPConfigAllOf) GetProtocolsOk() ([]MFAProtocols, bool) { + if o == nil || o.Protocols == nil { + return nil, false + } + return o.Protocols, true +} + +// HasProtocols returns a boolean if a field has been set. +func (o *UserTOTPConfigAllOf) HasProtocols() bool { + if o != nil && o.Protocols != nil { + return true + } + + return false +} + +// SetProtocols gets a reference to the given []MFAProtocols and assigns it to the Protocols field. +func (o *UserTOTPConfigAllOf) SetProtocols(v []MFAProtocols) { + o.Protocols = v +} + +func (o UserTOTPConfigAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Protocols != nil { + toSerialize["protocols"] = o.Protocols + } + return json.Marshal(toSerialize) +} + +type NullableUserTOTPConfigAllOf struct { + value *UserTOTPConfigAllOf + isSet bool +} + +func (v NullableUserTOTPConfigAllOf) Get() *UserTOTPConfigAllOf { + return v.value +} + +func (v *NullableUserTOTPConfigAllOf) Set(val *UserTOTPConfigAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableUserTOTPConfigAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableUserTOTPConfigAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserTOTPConfigAllOf(val *UserTOTPConfigAllOf) *NullableUserTOTPConfigAllOf { + return &NullableUserTOTPConfigAllOf{value: val, isSet: true} +} + +func (v NullableUserTOTPConfigAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserTOTPConfigAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_user_type.go b/server/common/sftpgo/v2/openapi/model_user_type.go new file mode 100644 index 00000000..aa10c838 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_user_type.go @@ -0,0 +1,113 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// UserType This is an hint for authentication plugins. It is ignored when using SFTPGo internal authentication +type UserType string + +// List of UserType +const ( + USERTYPE_EMPTY UserType = "" + USERTYPE_LDAP_USER UserType = "LDAPUser" + USERTYPE_OS_USER UserType = "OSUser" +) + +// All allowed values of UserType enum +var AllowedUserTypeEnumValues = []UserType{ + "", + "LDAPUser", + "OSUser", +} + +func (v *UserType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := UserType(value) + for _, existing := range AllowedUserTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid UserType", value) +} + +// NewUserTypeFromValue returns a pointer to a valid UserType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUserTypeFromValue(v string) (*UserType, error) { + ev := UserType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UserType: valid values are %v", v, AllowedUserTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UserType) IsValid() bool { + for _, existing := range AllowedUserTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UserType value +func (v UserType) Ptr() *UserType { + return &v +} + +type NullableUserType struct { + value *UserType + isSet bool +} + +func (v NullableUserType) Get() *UserType { + return v.value +} + +func (v *NullableUserType) Set(val *UserType) { + v.value = val + v.isSet = true +} + +func (v NullableUserType) IsSet() bool { + return v.isSet +} + +func (v *NullableUserType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserType(val *UserType) *NullableUserType { + return &NullableUserType{value: val, isSet: true} +} + +func (v NullableUserType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_version_info.go b/server/common/sftpgo/v2/openapi/model_version_info.go new file mode 100644 index 00000000..29faf808 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_version_info.go @@ -0,0 +1,224 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// VersionInfo struct for VersionInfo +type VersionInfo struct { + Version *string `json:"version,omitempty"` + BuildDate *string `json:"build_date,omitempty"` + CommitHash *string `json:"commit_hash,omitempty"` + // Features for the current build. Available features are \"portable\", \"bolt\", \"mysql\", \"sqlite\", \"pgsql\", \"s3\", \"gcs\", \"metrics\". If a feature is available it has a \"+\" prefix, otherwise a \"-\" prefix + Features []string `json:"features,omitempty"` +} + +// NewVersionInfo instantiates a new VersionInfo object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVersionInfo() *VersionInfo { + this := VersionInfo{} + return &this +} + +// NewVersionInfoWithDefaults instantiates a new VersionInfo object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVersionInfoWithDefaults() *VersionInfo { + this := VersionInfo{} + return &this +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *VersionInfo) GetVersion() string { + if o == nil || o.Version == nil { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VersionInfo) GetVersionOk() (*string, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *VersionInfo) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *VersionInfo) SetVersion(v string) { + o.Version = &v +} + +// GetBuildDate returns the BuildDate field value if set, zero value otherwise. +func (o *VersionInfo) GetBuildDate() string { + if o == nil || o.BuildDate == nil { + var ret string + return ret + } + return *o.BuildDate +} + +// GetBuildDateOk returns a tuple with the BuildDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VersionInfo) GetBuildDateOk() (*string, bool) { + if o == nil || o.BuildDate == nil { + return nil, false + } + return o.BuildDate, true +} + +// HasBuildDate returns a boolean if a field has been set. +func (o *VersionInfo) HasBuildDate() bool { + if o != nil && o.BuildDate != nil { + return true + } + + return false +} + +// SetBuildDate gets a reference to the given string and assigns it to the BuildDate field. +func (o *VersionInfo) SetBuildDate(v string) { + o.BuildDate = &v +} + +// GetCommitHash returns the CommitHash field value if set, zero value otherwise. +func (o *VersionInfo) GetCommitHash() string { + if o == nil || o.CommitHash == nil { + var ret string + return ret + } + return *o.CommitHash +} + +// GetCommitHashOk returns a tuple with the CommitHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VersionInfo) GetCommitHashOk() (*string, bool) { + if o == nil || o.CommitHash == nil { + return nil, false + } + return o.CommitHash, true +} + +// HasCommitHash returns a boolean if a field has been set. +func (o *VersionInfo) HasCommitHash() bool { + if o != nil && o.CommitHash != nil { + return true + } + + return false +} + +// SetCommitHash gets a reference to the given string and assigns it to the CommitHash field. +func (o *VersionInfo) SetCommitHash(v string) { + o.CommitHash = &v +} + +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *VersionInfo) GetFeatures() []string { + if o == nil || o.Features == nil { + var ret []string + return ret + } + return o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VersionInfo) GetFeaturesOk() ([]string, bool) { + if o == nil || o.Features == nil { + return nil, false + } + return o.Features, true +} + +// HasFeatures returns a boolean if a field has been set. +func (o *VersionInfo) HasFeatures() bool { + if o != nil && o.Features != nil { + return true + } + + return false +} + +// SetFeatures gets a reference to the given []string and assigns it to the Features field. +func (o *VersionInfo) SetFeatures(v []string) { + o.Features = v +} + +func (o VersionInfo) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Version != nil { + toSerialize["version"] = o.Version + } + if o.BuildDate != nil { + toSerialize["build_date"] = o.BuildDate + } + if o.CommitHash != nil { + toSerialize["commit_hash"] = o.CommitHash + } + if o.Features != nil { + toSerialize["features"] = o.Features + } + return json.Marshal(toSerialize) +} + +type NullableVersionInfo struct { + value *VersionInfo + isSet bool +} + +func (v NullableVersionInfo) Get() *VersionInfo { + return v.value +} + +func (v *NullableVersionInfo) Set(val *VersionInfo) { + v.value = val + v.isSet = true +} + +func (v NullableVersionInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableVersionInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVersionInfo(val *VersionInfo) *NullableVersionInfo { + return &NullableVersionInfo{value: val, isSet: true} +} + +func (v NullableVersionInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVersionInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_virtual_folder.go b/server/common/sftpgo/v2/openapi/model_virtual_folder.go new file mode 100644 index 00000000..9873959e --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_virtual_folder.go @@ -0,0 +1,511 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// VirtualFolder A virtual folder is a mapping between a SFTPGo virtual path and a filesystem path outside the user home directory. The specified paths must be absolute and the virtual path cannot be \"/\", it must be a sub directory. The parent directory for the specified virtual path must exist. SFTPGo will try to automatically create any missing parent directory for the configured virtual folders at user login. +type VirtualFolder struct { + Id *int32 `json:"id,omitempty"` + // unique name for this virtual folder + Name *string `json:"name,omitempty"` + // absolute filesystem path to use as virtual folder + MappedPath *string `json:"mapped_path,omitempty"` + // optional description + Description *string `json:"description,omitempty"` + UsedQuotaSize *int64 `json:"used_quota_size,omitempty"` + UsedQuotaFiles *int32 `json:"used_quota_files,omitempty"` + // Last quota update as unix timestamp in milliseconds + LastQuotaUpdate *int64 `json:"last_quota_update,omitempty"` + // list of usernames associated with this virtual folder + Users []string `json:"users,omitempty"` + Filesystem *FilesystemConfig `json:"filesystem,omitempty"` + VirtualPath string `json:"virtual_path"` + // Quota as size in bytes. 0 menas unlimited, -1 means included in user quota. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed + QuotaSize *int64 `json:"quota_size,omitempty"` + // Quota as number of files. 0 menas unlimited, , -1 means included in user quota. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed + QuotaFiles *int32 `json:"quota_files,omitempty"` +} + +// NewVirtualFolder instantiates a new VirtualFolder object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVirtualFolder(virtualPath string) *VirtualFolder { + this := VirtualFolder{} + this.VirtualPath = virtualPath + return &this +} + +// NewVirtualFolderWithDefaults instantiates a new VirtualFolder object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVirtualFolderWithDefaults() *VirtualFolder { + this := VirtualFolder{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *VirtualFolder) GetId() int32 { + if o == nil || o.Id == nil { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetIdOk() (*int32, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *VirtualFolder) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *VirtualFolder) SetId(v int32) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VirtualFolder) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *VirtualFolder) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VirtualFolder) SetName(v string) { + o.Name = &v +} + +// GetMappedPath returns the MappedPath field value if set, zero value otherwise. +func (o *VirtualFolder) GetMappedPath() string { + if o == nil || o.MappedPath == nil { + var ret string + return ret + } + return *o.MappedPath +} + +// GetMappedPathOk returns a tuple with the MappedPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetMappedPathOk() (*string, bool) { + if o == nil || o.MappedPath == nil { + return nil, false + } + return o.MappedPath, true +} + +// HasMappedPath returns a boolean if a field has been set. +func (o *VirtualFolder) HasMappedPath() bool { + if o != nil && o.MappedPath != nil { + return true + } + + return false +} + +// SetMappedPath gets a reference to the given string and assigns it to the MappedPath field. +func (o *VirtualFolder) SetMappedPath(v string) { + o.MappedPath = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VirtualFolder) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VirtualFolder) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VirtualFolder) SetDescription(v string) { + o.Description = &v +} + +// GetUsedQuotaSize returns the UsedQuotaSize field value if set, zero value otherwise. +func (o *VirtualFolder) GetUsedQuotaSize() int64 { + if o == nil || o.UsedQuotaSize == nil { + var ret int64 + return ret + } + return *o.UsedQuotaSize +} + +// GetUsedQuotaSizeOk returns a tuple with the UsedQuotaSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetUsedQuotaSizeOk() (*int64, bool) { + if o == nil || o.UsedQuotaSize == nil { + return nil, false + } + return o.UsedQuotaSize, true +} + +// HasUsedQuotaSize returns a boolean if a field has been set. +func (o *VirtualFolder) HasUsedQuotaSize() bool { + if o != nil && o.UsedQuotaSize != nil { + return true + } + + return false +} + +// SetUsedQuotaSize gets a reference to the given int64 and assigns it to the UsedQuotaSize field. +func (o *VirtualFolder) SetUsedQuotaSize(v int64) { + o.UsedQuotaSize = &v +} + +// GetUsedQuotaFiles returns the UsedQuotaFiles field value if set, zero value otherwise. +func (o *VirtualFolder) GetUsedQuotaFiles() int32 { + if o == nil || o.UsedQuotaFiles == nil { + var ret int32 + return ret + } + return *o.UsedQuotaFiles +} + +// GetUsedQuotaFilesOk returns a tuple with the UsedQuotaFiles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetUsedQuotaFilesOk() (*int32, bool) { + if o == nil || o.UsedQuotaFiles == nil { + return nil, false + } + return o.UsedQuotaFiles, true +} + +// HasUsedQuotaFiles returns a boolean if a field has been set. +func (o *VirtualFolder) HasUsedQuotaFiles() bool { + if o != nil && o.UsedQuotaFiles != nil { + return true + } + + return false +} + +// SetUsedQuotaFiles gets a reference to the given int32 and assigns it to the UsedQuotaFiles field. +func (o *VirtualFolder) SetUsedQuotaFiles(v int32) { + o.UsedQuotaFiles = &v +} + +// GetLastQuotaUpdate returns the LastQuotaUpdate field value if set, zero value otherwise. +func (o *VirtualFolder) GetLastQuotaUpdate() int64 { + if o == nil || o.LastQuotaUpdate == nil { + var ret int64 + return ret + } + return *o.LastQuotaUpdate +} + +// GetLastQuotaUpdateOk returns a tuple with the LastQuotaUpdate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetLastQuotaUpdateOk() (*int64, bool) { + if o == nil || o.LastQuotaUpdate == nil { + return nil, false + } + return o.LastQuotaUpdate, true +} + +// HasLastQuotaUpdate returns a boolean if a field has been set. +func (o *VirtualFolder) HasLastQuotaUpdate() bool { + if o != nil && o.LastQuotaUpdate != nil { + return true + } + + return false +} + +// SetLastQuotaUpdate gets a reference to the given int64 and assigns it to the LastQuotaUpdate field. +func (o *VirtualFolder) SetLastQuotaUpdate(v int64) { + o.LastQuotaUpdate = &v +} + +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *VirtualFolder) GetUsers() []string { + if o == nil || o.Users == nil { + var ret []string + return ret + } + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetUsersOk() ([]string, bool) { + if o == nil || o.Users == nil { + return nil, false + } + return o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *VirtualFolder) HasUsers() bool { + if o != nil && o.Users != nil { + return true + } + + return false +} + +// SetUsers gets a reference to the given []string and assigns it to the Users field. +func (o *VirtualFolder) SetUsers(v []string) { + o.Users = v +} + +// GetFilesystem returns the Filesystem field value if set, zero value otherwise. +func (o *VirtualFolder) GetFilesystem() FilesystemConfig { + if o == nil || o.Filesystem == nil { + var ret FilesystemConfig + return ret + } + return *o.Filesystem +} + +// GetFilesystemOk returns a tuple with the Filesystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetFilesystemOk() (*FilesystemConfig, bool) { + if o == nil || o.Filesystem == nil { + return nil, false + } + return o.Filesystem, true +} + +// HasFilesystem returns a boolean if a field has been set. +func (o *VirtualFolder) HasFilesystem() bool { + if o != nil && o.Filesystem != nil { + return true + } + + return false +} + +// SetFilesystem gets a reference to the given FilesystemConfig and assigns it to the Filesystem field. +func (o *VirtualFolder) SetFilesystem(v FilesystemConfig) { + o.Filesystem = &v +} + +// GetVirtualPath returns the VirtualPath field value +func (o *VirtualFolder) GetVirtualPath() string { + if o == nil { + var ret string + return ret + } + + return o.VirtualPath +} + +// GetVirtualPathOk returns a tuple with the VirtualPath field value +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetVirtualPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.VirtualPath, true +} + +// SetVirtualPath sets field value +func (o *VirtualFolder) SetVirtualPath(v string) { + o.VirtualPath = v +} + +// GetQuotaSize returns the QuotaSize field value if set, zero value otherwise. +func (o *VirtualFolder) GetQuotaSize() int64 { + if o == nil || o.QuotaSize == nil { + var ret int64 + return ret + } + return *o.QuotaSize +} + +// GetQuotaSizeOk returns a tuple with the QuotaSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetQuotaSizeOk() (*int64, bool) { + if o == nil || o.QuotaSize == nil { + return nil, false + } + return o.QuotaSize, true +} + +// HasQuotaSize returns a boolean if a field has been set. +func (o *VirtualFolder) HasQuotaSize() bool { + if o != nil && o.QuotaSize != nil { + return true + } + + return false +} + +// SetQuotaSize gets a reference to the given int64 and assigns it to the QuotaSize field. +func (o *VirtualFolder) SetQuotaSize(v int64) { + o.QuotaSize = &v +} + +// GetQuotaFiles returns the QuotaFiles field value if set, zero value otherwise. +func (o *VirtualFolder) GetQuotaFiles() int32 { + if o == nil || o.QuotaFiles == nil { + var ret int32 + return ret + } + return *o.QuotaFiles +} + +// GetQuotaFilesOk returns a tuple with the QuotaFiles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolder) GetQuotaFilesOk() (*int32, bool) { + if o == nil || o.QuotaFiles == nil { + return nil, false + } + return o.QuotaFiles, true +} + +// HasQuotaFiles returns a boolean if a field has been set. +func (o *VirtualFolder) HasQuotaFiles() bool { + if o != nil && o.QuotaFiles != nil { + return true + } + + return false +} + +// SetQuotaFiles gets a reference to the given int32 and assigns it to the QuotaFiles field. +func (o *VirtualFolder) SetQuotaFiles(v int32) { + o.QuotaFiles = &v +} + +func (o VirtualFolder) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.MappedPath != nil { + toSerialize["mapped_path"] = o.MappedPath + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.UsedQuotaSize != nil { + toSerialize["used_quota_size"] = o.UsedQuotaSize + } + if o.UsedQuotaFiles != nil { + toSerialize["used_quota_files"] = o.UsedQuotaFiles + } + if o.LastQuotaUpdate != nil { + toSerialize["last_quota_update"] = o.LastQuotaUpdate + } + if o.Users != nil { + toSerialize["users"] = o.Users + } + if o.Filesystem != nil { + toSerialize["filesystem"] = o.Filesystem + } + if true { + toSerialize["virtual_path"] = o.VirtualPath + } + if o.QuotaSize != nil { + toSerialize["quota_size"] = o.QuotaSize + } + if o.QuotaFiles != nil { + toSerialize["quota_files"] = o.QuotaFiles + } + return json.Marshal(toSerialize) +} + +type NullableVirtualFolder struct { + value *VirtualFolder + isSet bool +} + +func (v NullableVirtualFolder) Get() *VirtualFolder { + return v.value +} + +func (v *NullableVirtualFolder) Set(val *VirtualFolder) { + v.value = val + v.isSet = true +} + +func (v NullableVirtualFolder) IsSet() bool { + return v.isSet +} + +func (v *NullableVirtualFolder) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVirtualFolder(val *VirtualFolder) *NullableVirtualFolder { + return &NullableVirtualFolder{value: val, isSet: true} +} + +func (v NullableVirtualFolder) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVirtualFolder) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_virtual_folder_all_of.go b/server/common/sftpgo/v2/openapi/model_virtual_folder_all_of.go new file mode 100644 index 00000000..9521ac37 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_virtual_folder_all_of.go @@ -0,0 +1,182 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// VirtualFolderAllOf struct for VirtualFolderAllOf +type VirtualFolderAllOf struct { + VirtualPath string `json:"virtual_path"` + // Quota as size in bytes. 0 menas unlimited, -1 means included in user quota. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed + QuotaSize *int64 `json:"quota_size,omitempty"` + // Quota as number of files. 0 menas unlimited, , -1 means included in user quota. Please note that quota is updated if files are added/removed via SFTPGo otherwise a quota scan or a manual quota update is needed + QuotaFiles *int32 `json:"quota_files,omitempty"` +} + +// NewVirtualFolderAllOf instantiates a new VirtualFolderAllOf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVirtualFolderAllOf(virtualPath string) *VirtualFolderAllOf { + this := VirtualFolderAllOf{} + this.VirtualPath = virtualPath + return &this +} + +// NewVirtualFolderAllOfWithDefaults instantiates a new VirtualFolderAllOf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVirtualFolderAllOfWithDefaults() *VirtualFolderAllOf { + this := VirtualFolderAllOf{} + return &this +} + +// GetVirtualPath returns the VirtualPath field value +func (o *VirtualFolderAllOf) GetVirtualPath() string { + if o == nil { + var ret string + return ret + } + + return o.VirtualPath +} + +// GetVirtualPathOk returns a tuple with the VirtualPath field value +// and a boolean to check if the value has been set. +func (o *VirtualFolderAllOf) GetVirtualPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.VirtualPath, true +} + +// SetVirtualPath sets field value +func (o *VirtualFolderAllOf) SetVirtualPath(v string) { + o.VirtualPath = v +} + +// GetQuotaSize returns the QuotaSize field value if set, zero value otherwise. +func (o *VirtualFolderAllOf) GetQuotaSize() int64 { + if o == nil || o.QuotaSize == nil { + var ret int64 + return ret + } + return *o.QuotaSize +} + +// GetQuotaSizeOk returns a tuple with the QuotaSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolderAllOf) GetQuotaSizeOk() (*int64, bool) { + if o == nil || o.QuotaSize == nil { + return nil, false + } + return o.QuotaSize, true +} + +// HasQuotaSize returns a boolean if a field has been set. +func (o *VirtualFolderAllOf) HasQuotaSize() bool { + if o != nil && o.QuotaSize != nil { + return true + } + + return false +} + +// SetQuotaSize gets a reference to the given int64 and assigns it to the QuotaSize field. +func (o *VirtualFolderAllOf) SetQuotaSize(v int64) { + o.QuotaSize = &v +} + +// GetQuotaFiles returns the QuotaFiles field value if set, zero value otherwise. +func (o *VirtualFolderAllOf) GetQuotaFiles() int32 { + if o == nil || o.QuotaFiles == nil { + var ret int32 + return ret + } + return *o.QuotaFiles +} + +// GetQuotaFilesOk returns a tuple with the QuotaFiles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualFolderAllOf) GetQuotaFilesOk() (*int32, bool) { + if o == nil || o.QuotaFiles == nil { + return nil, false + } + return o.QuotaFiles, true +} + +// HasQuotaFiles returns a boolean if a field has been set. +func (o *VirtualFolderAllOf) HasQuotaFiles() bool { + if o != nil && o.QuotaFiles != nil { + return true + } + + return false +} + +// SetQuotaFiles gets a reference to the given int32 and assigns it to the QuotaFiles field. +func (o *VirtualFolderAllOf) SetQuotaFiles(v int32) { + o.QuotaFiles = &v +} + +func (o VirtualFolderAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["virtual_path"] = o.VirtualPath + } + if o.QuotaSize != nil { + toSerialize["quota_size"] = o.QuotaSize + } + if o.QuotaFiles != nil { + toSerialize["quota_files"] = o.QuotaFiles + } + return json.Marshal(toSerialize) +} + +type NullableVirtualFolderAllOf struct { + value *VirtualFolderAllOf + isSet bool +} + +func (v NullableVirtualFolderAllOf) Get() *VirtualFolderAllOf { + return v.value +} + +func (v *NullableVirtualFolderAllOf) Set(val *VirtualFolderAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableVirtualFolderAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableVirtualFolderAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVirtualFolderAllOf(val *VirtualFolderAllOf) *NullableVirtualFolderAllOf { + return &NullableVirtualFolderAllOf{value: val, isSet: true} +} + +func (v NullableVirtualFolderAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVirtualFolderAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_web_client_options.go b/server/common/sftpgo/v2/openapi/model_web_client_options.go new file mode 100644 index 00000000..dd65121b --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_web_client_options.go @@ -0,0 +1,123 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// WebClientOptions Options: * `publickey-change-disabled` - changing SSH public keys is not allowed * `write-disabled` - upload, rename, delete are not allowed even if the user has permissions for these actions * `mfa-disabled` - enabling multi-factor authentication is not allowed. This option cannot be set if the user has MFA already enabled * `password-change-disabled` - changing password is not allowed * `api-key-auth-change-disabled` - enabling/disabling API key authentication is not allowed * `info-change-disabled` - changing info such as email and description is not allowed * `shares-disabled` - sharing files and directories with external users is disabled * `password-reset-disabled` - resetting the password is disabled +type WebClientOptions string + +// List of WebClientOptions +const ( + WEBCLIENTOPTIONS_PUBLICKEY_CHANGE_DISABLED WebClientOptions = "publickey-change-disabled" + WEBCLIENTOPTIONS_WRITE_DISABLED WebClientOptions = "write-disabled" + WEBCLIENTOPTIONS_MFA_DISABLED WebClientOptions = "mfa-disabled" + WEBCLIENTOPTIONS_PASSWORD_CHANGE_DISABLED WebClientOptions = "password-change-disabled" + WEBCLIENTOPTIONS_API_KEY_AUTH_CHANGE_DISABLED WebClientOptions = "api-key-auth-change-disabled" + WEBCLIENTOPTIONS_INFO_CHANGE_DISABLED WebClientOptions = "info-change-disabled" + WEBCLIENTOPTIONS_SHARES_DISABLED WebClientOptions = "shares-disabled" + WEBCLIENTOPTIONS_PASSWORD_RESET_DISABLED WebClientOptions = "password-reset-disabled" +) + +// All allowed values of WebClientOptions enum +var AllowedWebClientOptionsEnumValues = []WebClientOptions{ + "publickey-change-disabled", + "write-disabled", + "mfa-disabled", + "password-change-disabled", + "api-key-auth-change-disabled", + "info-change-disabled", + "shares-disabled", + "password-reset-disabled", +} + +func (v *WebClientOptions) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := WebClientOptions(value) + for _, existing := range AllowedWebClientOptionsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid WebClientOptions", value) +} + +// NewWebClientOptionsFromValue returns a pointer to a valid WebClientOptions +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewWebClientOptionsFromValue(v string) (*WebClientOptions, error) { + ev := WebClientOptions(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for WebClientOptions: valid values are %v", v, AllowedWebClientOptionsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v WebClientOptions) IsValid() bool { + for _, existing := range AllowedWebClientOptionsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WebClientOptions value +func (v WebClientOptions) Ptr() *WebClientOptions { + return &v +} + +type NullableWebClientOptions struct { + value *WebClientOptions + isSet bool +} + +func (v NullableWebClientOptions) Get() *WebClientOptions { + return v.value +} + +func (v *NullableWebClientOptions) Set(val *WebClientOptions) { + v.value = val + v.isSet = true +} + +func (v NullableWebClientOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableWebClientOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWebClientOptions(val *WebClientOptions) *NullableWebClientOptions { + return &NullableWebClientOptions{value: val, isSet: true} +} + +func (v NullableWebClientOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWebClientOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/server/common/sftpgo/v2/openapi/model_web_dav_binding.go b/server/common/sftpgo/v2/openapi/model_web_dav_binding.go new file mode 100644 index 00000000..d07ac9f5 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_web_dav_binding.go @@ -0,0 +1,226 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// WebDAVBinding struct for WebDAVBinding +type WebDAVBinding struct { + // TCP address the server listen on + Address *string `json:"address,omitempty"` + // the port used for serving requests + Port *int32 `json:"port,omitempty"` + EnableHttps *bool `json:"enable_https,omitempty"` + // 1 means that client certificate authentication is required in addition to HTTP basic authentication + ClientAuthType *int32 `json:"client_auth_type,omitempty"` +} + +// NewWebDAVBinding instantiates a new WebDAVBinding object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewWebDAVBinding() *WebDAVBinding { + this := WebDAVBinding{} + return &this +} + +// NewWebDAVBindingWithDefaults instantiates a new WebDAVBinding object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewWebDAVBindingWithDefaults() *WebDAVBinding { + this := WebDAVBinding{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *WebDAVBinding) GetAddress() string { + if o == nil || o.Address == nil { + var ret string + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebDAVBinding) GetAddressOk() (*string, bool) { + if o == nil || o.Address == nil { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *WebDAVBinding) HasAddress() bool { + if o != nil && o.Address != nil { + return true + } + + return false +} + +// SetAddress gets a reference to the given string and assigns it to the Address field. +func (o *WebDAVBinding) SetAddress(v string) { + o.Address = &v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *WebDAVBinding) GetPort() int32 { + if o == nil || o.Port == nil { + var ret int32 + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebDAVBinding) GetPortOk() (*int32, bool) { + if o == nil || o.Port == nil { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *WebDAVBinding) HasPort() bool { + if o != nil && o.Port != nil { + return true + } + + return false +} + +// SetPort gets a reference to the given int32 and assigns it to the Port field. +func (o *WebDAVBinding) SetPort(v int32) { + o.Port = &v +} + +// GetEnableHttps returns the EnableHttps field value if set, zero value otherwise. +func (o *WebDAVBinding) GetEnableHttps() bool { + if o == nil || o.EnableHttps == nil { + var ret bool + return ret + } + return *o.EnableHttps +} + +// GetEnableHttpsOk returns a tuple with the EnableHttps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebDAVBinding) GetEnableHttpsOk() (*bool, bool) { + if o == nil || o.EnableHttps == nil { + return nil, false + } + return o.EnableHttps, true +} + +// HasEnableHttps returns a boolean if a field has been set. +func (o *WebDAVBinding) HasEnableHttps() bool { + if o != nil && o.EnableHttps != nil { + return true + } + + return false +} + +// SetEnableHttps gets a reference to the given bool and assigns it to the EnableHttps field. +func (o *WebDAVBinding) SetEnableHttps(v bool) { + o.EnableHttps = &v +} + +// GetClientAuthType returns the ClientAuthType field value if set, zero value otherwise. +func (o *WebDAVBinding) GetClientAuthType() int32 { + if o == nil || o.ClientAuthType == nil { + var ret int32 + return ret + } + return *o.ClientAuthType +} + +// GetClientAuthTypeOk returns a tuple with the ClientAuthType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebDAVBinding) GetClientAuthTypeOk() (*int32, bool) { + if o == nil || o.ClientAuthType == nil { + return nil, false + } + return o.ClientAuthType, true +} + +// HasClientAuthType returns a boolean if a field has been set. +func (o *WebDAVBinding) HasClientAuthType() bool { + if o != nil && o.ClientAuthType != nil { + return true + } + + return false +} + +// SetClientAuthType gets a reference to the given int32 and assigns it to the ClientAuthType field. +func (o *WebDAVBinding) SetClientAuthType(v int32) { + o.ClientAuthType = &v +} + +func (o WebDAVBinding) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Address != nil { + toSerialize["address"] = o.Address + } + if o.Port != nil { + toSerialize["port"] = o.Port + } + if o.EnableHttps != nil { + toSerialize["enable_https"] = o.EnableHttps + } + if o.ClientAuthType != nil { + toSerialize["client_auth_type"] = o.ClientAuthType + } + return json.Marshal(toSerialize) +} + +type NullableWebDAVBinding struct { + value *WebDAVBinding + isSet bool +} + +func (v NullableWebDAVBinding) Get() *WebDAVBinding { + return v.value +} + +func (v *NullableWebDAVBinding) Set(val *WebDAVBinding) { + v.value = val + v.isSet = true +} + +func (v NullableWebDAVBinding) IsSet() bool { + return v.isSet +} + +func (v *NullableWebDAVBinding) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWebDAVBinding(val *WebDAVBinding) *NullableWebDAVBinding { + return &NullableWebDAVBinding{value: val, isSet: true} +} + +func (v NullableWebDAVBinding) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWebDAVBinding) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/model_web_dav_service_status.go b/server/common/sftpgo/v2/openapi/model_web_dav_service_status.go new file mode 100644 index 00000000..b9ff7f31 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/model_web_dav_service_status.go @@ -0,0 +1,152 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// WebDAVServiceStatus struct for WebDAVServiceStatus +type WebDAVServiceStatus struct { + IsActive *bool `json:"is_active,omitempty"` + Bindings []WebDAVBinding `json:"bindings,omitempty"` +} + +// NewWebDAVServiceStatus instantiates a new WebDAVServiceStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewWebDAVServiceStatus() *WebDAVServiceStatus { + this := WebDAVServiceStatus{} + return &this +} + +// NewWebDAVServiceStatusWithDefaults instantiates a new WebDAVServiceStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewWebDAVServiceStatusWithDefaults() *WebDAVServiceStatus { + this := WebDAVServiceStatus{} + return &this +} + +// GetIsActive returns the IsActive field value if set, zero value otherwise. +func (o *WebDAVServiceStatus) GetIsActive() bool { + if o == nil || o.IsActive == nil { + var ret bool + return ret + } + return *o.IsActive +} + +// GetIsActiveOk returns a tuple with the IsActive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebDAVServiceStatus) GetIsActiveOk() (*bool, bool) { + if o == nil || o.IsActive == nil { + return nil, false + } + return o.IsActive, true +} + +// HasIsActive returns a boolean if a field has been set. +func (o *WebDAVServiceStatus) HasIsActive() bool { + if o != nil && o.IsActive != nil { + return true + } + + return false +} + +// SetIsActive gets a reference to the given bool and assigns it to the IsActive field. +func (o *WebDAVServiceStatus) SetIsActive(v bool) { + o.IsActive = &v +} + +// GetBindings returns the Bindings field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *WebDAVServiceStatus) GetBindings() []WebDAVBinding { + if o == nil { + var ret []WebDAVBinding + return ret + } + return o.Bindings +} + +// GetBindingsOk returns a tuple with the Bindings field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *WebDAVServiceStatus) GetBindingsOk() ([]WebDAVBinding, bool) { + if o == nil || o.Bindings == nil { + return nil, false + } + return o.Bindings, true +} + +// HasBindings returns a boolean if a field has been set. +func (o *WebDAVServiceStatus) HasBindings() bool { + if o != nil && o.Bindings != nil { + return true + } + + return false +} + +// SetBindings gets a reference to the given []WebDAVBinding and assigns it to the Bindings field. +func (o *WebDAVServiceStatus) SetBindings(v []WebDAVBinding) { + o.Bindings = v +} + +func (o WebDAVServiceStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.IsActive != nil { + toSerialize["is_active"] = o.IsActive + } + if o.Bindings != nil { + toSerialize["bindings"] = o.Bindings + } + return json.Marshal(toSerialize) +} + +type NullableWebDAVServiceStatus struct { + value *WebDAVServiceStatus + isSet bool +} + +func (v NullableWebDAVServiceStatus) Get() *WebDAVServiceStatus { + return v.value +} + +func (v *NullableWebDAVServiceStatus) Set(val *WebDAVServiceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableWebDAVServiceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableWebDAVServiceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWebDAVServiceStatus(val *WebDAVServiceStatus) *NullableWebDAVServiceStatus { + return &NullableWebDAVServiceStatus{value: val, isSet: true} +} + +func (v NullableWebDAVServiceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWebDAVServiceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/server/common/sftpgo/v2/openapi/response.go b/server/common/sftpgo/v2/openapi/response.go new file mode 100644 index 00000000..65f03cc3 --- /dev/null +++ b/server/common/sftpgo/v2/openapi/response.go @@ -0,0 +1,47 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/server/common/sftpgo/v2/openapi/utils.go b/server/common/sftpgo/v2/openapi/utils.go new file mode 100644 index 00000000..b517f29c --- /dev/null +++ b/server/common/sftpgo/v2/openapi/utils.go @@ -0,0 +1,328 @@ +/* +SFTPGo + +SFTPGo allows to securely share your files over SFTP, HTTP and optionally FTP/S and WebDAV as well. Several storage backends are supported and they are configurable per user, so you can serve a local directory for a user and an S3 bucket (or part of it) for another one. SFTPGo also supports virtual folders, a virtual folder can use any of the supported storage backends. So you can have, for example, an S3 user that exposes a GCS bucket (or part of it) on a specified path and an encrypted local filesystem on another one. Virtual folders can be private or shared among multiple users, for shared virtual folders you can define different quota limits for each user. SFTPGo allows to create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. + +API version: 2.2.2-dev +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/server/common/utils/encrypt_test.go b/server/common/utils/encrypt_test.go new file mode 100644 index 00000000..0f6d939d --- /dev/null +++ b/server/common/utils/encrypt_test.go @@ -0,0 +1,12 @@ +package utils + +import "testing" + +func TestEncryptPassword(t *testing.T) { + p, err := EncryptPassword("hello world") + if err != nil { + t.Error(err) + return + } + t.Log(p) +} diff --git a/server/openai-server/api/v1/trainJob.proto b/server/openai-server/api/v1/trainJob.proto index affffdae..48cde012 100644 --- a/server/openai-server/api/v1/trainJob.proto +++ b/server/openai-server/api/v1/trainJob.proto @@ -93,20 +93,22 @@ message TrainJobRequest { string name = 1[(validate.rules).string = {min_len: 1, max_len: 30}]; //训练任务描述,非必填 string desc = 2[(validate.rules).string = {max_len: 300}]; - //算法ID,必填 - string algorithmId = 3[(validate.rules).string = {min_len: 1}]; - //算法版本,必填 - string algorithmVersion = 4[(validate.rules).string = {min_len: 1}]; - //镜像ID,必填 - string imageId = 5[(validate.rules).string = {min_len: 1}]; - //数据集ID,必填 - string dataSetId = 7[(validate.rules).string = {min_len: 1}]; - //数据集版本,必填 - string dataSetVersion = 8[(validate.rules).string = {min_len: 1}]; + //算法ID,非必填 + string algorithmId = 3[(validate.rules).string = {min_len: 0}]; + //算法版本,非必填 + string algorithmVersion = 4[(validate.rules).string = {min_len: 0}]; + //镜像ID,非必填,镜像地址和镜像ID填一个 + string imageId = 5[(validate.rules).string = {min_len: 0}]; + //数据集ID,非必填 + string dataSetId = 7[(validate.rules).string = {min_len: 0}]; + //数据集版本,非必填 + string dataSetVersion = 8[(validate.rules).string = {min_len: 0}]; //是否分布式任务,非必填,默认false,若为分布式任务则为true bool isDistributed = 9; //job子任务及其配置信息,必填 repeated Config config = 10[(validate.rules).repeated.min_items = 1]; + //镜像地址,非必填,镜像地址和镜像ID填一个 + string imageUrl = 11[(validate.rules).string = {min_len: 0}]; } message Config { @@ -327,6 +329,7 @@ message TrainJob{ string imageVersion = 21; //启动时间 int64 startedAt = 22; + string imageUrl = 23; } message TrainJobTemplate{ diff --git a/server/openai-server/api/v1/user.proto b/server/openai-server/api/v1/user.proto index 2a15797f..84f21cfc 100644 --- a/server/openai-server/api/v1/user.proto +++ b/server/openai-server/api/v1/user.proto @@ -20,18 +20,19 @@ service User { get: "/v1/usermanage/user/{userId}/workspace" }; }; - rpc PutUserWorkspace (PutUserWorkspaceRequest) returns (PutUserWorkspaceReply) { - option (google.api.http) = { - put: "/v1/usermanage/user/{userId}/workspace" - body: "*" - }; - }; // 查询用户配置 rpc GetUserConfig (GetUserConfigRequest) returns (GetUserConfigReply) { option (google.api.http) = { get: "/v1/usermanage/config" }; }; + + rpc UpdateUserFtpAccount (UpdateUserFtpAccountRequest) returns (UpdateUserFtpAccountReply) { + option (google.api.http) = { + put: "/v1/usermanage/user/ftpaccount" + body: "*" + }; + }; } message UserItem { @@ -43,6 +44,7 @@ message UserItem { string phone = 6; int32 gender = 8; int32 status = 9; + string ftpUserName = 10; } message GetUserInfoRequest { @@ -50,7 +52,6 @@ message GetUserInfoRequest { message GetUserInfoReply { UserItem user = 1; - string workspaceId = 2; } message WorkspaceItem { @@ -74,18 +75,19 @@ message ListUserWorkspacesReply { repeated WorkspaceItem workspaces = 1; } -message PutUserWorkspaceRequest { - string userId = 1 [(validate.rules).string = {min_len: 1, max_len: 36}]; - string workspaceId = 2 [(validate.rules).string = {max_len: 36}]; +message GetUserConfigRequest { } -message PutUserWorkspaceReply { - +message GetUserConfigReply { + map config = 1; } -message GetUserConfigRequest { +message UpdateUserFtpAccountRequest { + string userId = 1; + string ftpUserName = 2 [(validate.rules).string = {pattern: "^[a-zA-Z0-9-_.~]+$"}]; + string ftpPassword = 3; } -message GetUserConfigReply { - map config = 1; +message UpdateUserFtpAccountReply { + UserItem ftpUserName = 1; } \ No newline at end of file diff --git a/server/openai-server/configs/config.yaml b/server/openai-server/configs/config.yaml index 55cbfac2..2ad9f573 100644 --- a/server/openai-server/configs/config.yaml +++ b/server/openai-server/configs/config.yaml @@ -19,7 +19,7 @@ data: baseServerAddr: dns:///127.0.0.1:9001 baseServerRequestTimeout: 30s redis: - addr: 192.168.202.73:31392 + addr: 192.168.202.73:30635 username: password: abcde service: diff --git a/server/openai-server/internal/data/data.go b/server/openai-server/internal/data/data.go index e7de24b2..e5d353db 100644 --- a/server/openai-server/internal/data/data.go +++ b/server/openai-server/internal/data/data.go @@ -7,7 +7,6 @@ import ( "server/common/log" "server/common/middleware/ctxcopy" "server/openai-server/internal/conf" - "server/openai-server/internal/data/session" "time" "github.com/go-kratos/kratos/v2/middleware" @@ -24,7 +23,6 @@ type Data struct { DevelopClient api.DevelopClient ModelClient api.ModelServiceClient WorkspaceClient api.WorkspaceServiceClient - SessionClient session.SessionClient ImageClient api.ImageServiceClient DatasetClient api.DatasetServiceClient ResourceSpecClient api.ResourceSpecServiceClient @@ -66,7 +64,6 @@ func NewData(confData *conf.Data, logger log.Logger) (*Data, error) { TrainJobClient: api.NewTrainJobServiceClient(conn), ModelClient: api.NewModelServiceClient(conn), WorkspaceClient: api.NewWorkspaceServiceClient(conn), - SessionClient: session.NewSessionClient(confData, logger), ImageClient: api.NewImageServiceClient(conn), DatasetClient: api.NewDatasetServiceClient(conn), ResourceSpecClient: api.NewResourceSpecServiceClient(conn), diff --git a/server/openai-server/internal/data/session/session.go b/server/openai-server/internal/data/session/session.go deleted file mode 100644 index 25306406..00000000 --- a/server/openai-server/internal/data/session/session.go +++ /dev/null @@ -1,51 +0,0 @@ -package session - -import ( - "context" - "server/common/constant" - "server/common/log" - ss "server/common/session" - "server/openai-server/internal/conf" -) - -type SessionClient interface { - ss.SessionStore -} - -func NewSessionClient(config *conf.Data, logger log.Logger) SessionClient { - logHelper := log.NewHelper("Session", logger) - - storeConfig := ss.SessionStoreConfig{ - RedisAddr: config.Redis.Addr, - RedisPassword: config.Redis.Password, - RedisUsername: config.Redis.Username, - RedisDBIndex: "0", - } - return &SessionClientImpl{ - config: config, - store: ss.NewSessionStore(constant.SESSION_KEY, storeConfig, logger), - logger: logHelper, - } -} - -type SessionClientImpl struct { - config *conf.Data - store ss.SessionStore - logger *log.Helper -} - -func (s *SessionClientImpl) Create(ctx context.Context, session *ss.Session) error { - return s.store.Create(ctx, session) -} - -func (s *SessionClientImpl) Get(ctx context.Context, sessionId string) (*ss.Session, error) { - return s.store.Get(ctx, sessionId) -} - -func (s *SessionClientImpl) Update(ctx context.Context, session *ss.Session) error { - return s.store.Update(ctx, session) -} - -func (s *SessionClientImpl) Delete(ctx context.Context, sessionId string) error { - return s.store.Delete(ctx, sessionId) -} diff --git a/server/openai-server/internal/server/http.go b/server/openai-server/internal/server/http.go index 4ab8118a..1c57e05b 100644 --- a/server/openai-server/internal/server/http.go +++ b/server/openai-server/internal/server/http.go @@ -2,22 +2,26 @@ package server import ( "context" + "fmt" nethttp "net/http" - innterapi "server/base-server/api/v1" + "net/http/httputil" + "net/url" + "server/common/constant" "server/common/constant/userconfig" - comCtx "server/common/context" + commctx "server/common/context" "server/common/errors" comHttp "server/common/http" + "server/common/log" "server/common/middleware/jwt" "server/common/middleware/logging" - "server/common/middleware/session" "server/common/middleware/validate" - ss "server/common/session" api "server/openai-server/api/v1" "server/openai-server/internal/conf" "server/openai-server/internal/service" "strings" + "github.com/gorilla/mux" + "github.com/go-kratos/kratos/v2/middleware" "github.com/go-kratos/kratos/v2/middleware/recovery" "github.com/go-kratos/kratos/v2/middleware/tracing" @@ -44,22 +48,6 @@ func NewHTTPServer(c *conf.Server, service *service.Service) *http.Server { options.NoAuthUris = noAuthUris }) - var sessionOpts = []session.Option{} - sessionOpts = append(sessionOpts, func(options *session.Options) { - options.Store = service.Data.SessionClient - options.NoAuthUris = noAuthUris - options.CheckSession = func(ctx context.Context, s *ss.Session) error { - if s.Status != int32(innterapi.UserStatus_ACTIVITY) { - return errors.Errorf(nil, errors.ErrorAuthenticationForbidden) - } - - if comCtx.CreatedAtFromContext(ctx) != s.CreatedAt { - return errors.Errorf(nil, errors.ErrorTokenRenew) - } - return nil - } - }) - options := []http.HandleOption{ http.Middleware( middleware.Chain( @@ -67,7 +55,7 @@ func NewHTTPServer(c *conf.Server, service *service.Service) *http.Server { tracing.Server(), logging.Server(), jwt.Server(jwtOpts...), - session.Server(sessionOpts...), + handleHeader(), checkJointCloudPerm(service), validate.Server(), ), @@ -83,6 +71,21 @@ func NewHTTPServer(c *conf.Server, service *service.Service) *http.Server { srv.HandlePrefix("/v1/authmanage", api.NewAuthHandler(service.AuthService, options...)) srv.HandlePrefix("/v1/algorithmmanage", api.NewAlgorithmHandler(service.AlgorithmService, options...)) srv.HandlePrefix("/v1/developmanage", api.NewDevelopHandler(service.DevelopService, options...)) + srv.HandleFunc("/v1/trainmanage/trainjob/{id}/task/{taskId}/replica/{replicaIdx}/log", func(w nethttp.ResponseWriter, r *nethttp.Request) { + proto := "http" + if strings.Contains(r.Proto, "HTTPS") { + proto = "https" + } + url, _ := url.Parse(fmt.Sprintf("%s://%s/log/user/trainjob/%s/%s/%s/index.log", proto, r.Host, mux.Vars(r)["id"], mux.Vars(r)["taskId"], mux.Vars(r)["replicaIdx"])) + log.Info(context.TODO(), url) + proxy := httputil.ReverseProxy{ + Director: func(request *nethttp.Request) { + request.URL = url + }, + } + + proxy.ServeHTTP(w, r) + }) srv.HandlePrefix("/v1/trainmanage", api.NewTrainJobServiceHandler(service.TrainJobService, options...)) srv.HandlePrefix("/v1/modelmanage", api.NewModelHandler(service.ModelService, options...)) srv.HandlePrefix("/v1/datasetmanage", api.NewDatasetServiceHandler(service.DatasetService, options...)) @@ -119,3 +122,24 @@ func checkJointCloudPerm(service *service.Service) middleware.Middleware { } } } + +func handleHeader() middleware.Middleware { + return func(handler middleware.Handler) middleware.Handler { + return func(ctx context.Context, req interface{}) (interface{}, error) { + var request *nethttp.Request + if info, ok := http.FromServerContext(ctx); ok { + request = info.Request + } else { + return handler(ctx, req) + } + + spaceId := request.Header.Get("Octopus-Space-Id") + if spaceId == "" { + spaceId = constant.SYSTEM_WORKSPACE_DEFAULT + } + + ctx = commctx.SpaceIdToContext(ctx, spaceId) + return handler(ctx, req) + } + } +} diff --git a/server/openai-server/internal/service/algorithm.go b/server/openai-server/internal/service/algorithm.go index ca0993c7..6b39f0a6 100644 --- a/server/openai-server/internal/service/algorithm.go +++ b/server/openai-server/internal/service/algorithm.go @@ -7,7 +7,6 @@ import ( commctx "server/common/context" "server/common/errors" "server/common/log" - ss "server/common/session" api "server/openai-server/api/v1" "server/openai-server/internal/conf" "server/openai-server/internal/data" @@ -106,11 +105,7 @@ func (s *AlgorithmService) ListPreAlgorithm(ctx context.Context, req *api.ListPr // 查询我的算法列表 func (s *AlgorithmService) ListMyAlgorithm(ctx context.Context, req *api.ListMyAlgorithmRequest) (*api.ListMyAlgorithmReply, error) { - - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.ListMyAlgorithm(ctx, &innterapi.ListMyAlgorithmRequest{ SpaceId: spaceId, @@ -142,10 +137,7 @@ func (s *AlgorithmService) ListMyAlgorithm(ctx context.Context, req *api.ListMyA // 查询公共算法列表 func (s *AlgorithmService) ListCommAlgorithm(ctx context.Context, req *api.ListCommAlgorithmRequest) (*api.ListCommAlgorithmReply, error) { - _, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + _, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.ListCommAlgorithm(ctx, &innterapi.ListCommAlgorithmRequest{ SpaceId: spaceId, @@ -176,11 +168,7 @@ func (s *AlgorithmService) ListCommAlgorithm(ctx context.Context, req *api.ListC // 查询算法版本列表 func (s *AlgorithmService) ListAlgorithmVersion(ctx context.Context, req *api.ListAlgorithmVersionRequest) (*api.ListAlgorithmVersionReply, error) { - - _, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + _, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.ListAlgorithmVersion(ctx, &innterapi.ListAlgorithmVersionRequest{ AlgorithmId: req.AlgorithmId, @@ -227,10 +215,7 @@ func (s *AlgorithmService) ListAlgorithmVersion(ctx context.Context, req *api.Li // 新增我的算法版本 func (s *AlgorithmService) AddMyAlgorithmVersion(ctx context.Context, req *api.AddMyAlgorithmVersionRequest) (*api.AddMyAlgorithmVersionReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.AddMyAlgorithmVersion(ctx, &innterapi.AddMyAlgorithmVersionRequest{ SpaceId: spaceId, @@ -253,11 +238,7 @@ func (s *AlgorithmService) AddMyAlgorithmVersion(ctx context.Context, req *api.A // 查询公共算法版本列表 func (s *AlgorithmService) ListCommAlgorithmVersion(ctx context.Context, req *api.ListCommAlgorithmVersionRequest) (*api.ListCommAlgorithmVersionReply, error) { - - _, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + _, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.ListCommAlgorithmVersion(ctx, &innterapi.ListCommAlgorithmVersionRequest{ SpaceId: spaceId, @@ -289,11 +270,7 @@ func (s *AlgorithmService) ListCommAlgorithmVersion(ctx context.Context, req *ap // 分享算法版本到公共算法 func (s *AlgorithmService) ShareAlgorithmVersion(ctx context.Context, req *api.ShareAlgorithmVersionRequest) (*api.ShareAlgorithmVersionReply, error) { - - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) ShareSpaceIdList := []string{} ShareSpaceIdList = append(ShareSpaceIdList, spaceId) @@ -316,11 +293,7 @@ func (s *AlgorithmService) ShareAlgorithmVersion(ctx context.Context, req *api.S // 取消分享算法版本到公共算法 func (s *AlgorithmService) CloseShareAlgorithmVersion(ctx context.Context, req *api.CloseShareAlgorithmVersionRequest) (*api.CloseShareAlgorithmVersionReply, error) { - - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) ShareSpaceIdList := []string{} ShareSpaceIdList = append(ShareSpaceIdList, spaceId) @@ -343,10 +316,7 @@ func (s *AlgorithmService) CloseShareAlgorithmVersion(ctx context.Context, req * // 删除我的算法版本 func (s *AlgorithmService) DeleteMyAlgorithmVersion(ctx context.Context, req *api.DeleteMyAlgorithmVersionRequest) (*api.DeleteMyAlgorithmVersionReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.DeleteMyAlgorithmVersion(ctx, &innterapi.DeleteMyAlgorithmVersionRequest{ SpaceId: spaceId, @@ -365,11 +335,7 @@ func (s *AlgorithmService) DeleteMyAlgorithmVersion(ctx context.Context, req *ap // 删除我的算法 func (s *AlgorithmService) DeleteMyAlgorithm(ctx context.Context, req *api.DeleteMyAlgorithmRequest) (*api.DeleteMyAlgorithmReply, error) { - - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.DeleteMyAlgorithm(ctx, &innterapi.DeleteMyAlgorithmRequest{ SpaceId: spaceId, @@ -404,11 +370,7 @@ func (s *AlgorithmService) DownloadAlgorithmVersionCompress(ctx context.Context, // 复制算法 func (s *AlgorithmService) CopyAlgorithmVersion(ctx context.Context, req *api.CopyAlgorithmVersionRequest) (*api.CopyAlgorithmVersionReply, error) { - - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.CopyAlgorithmVersion(ctx, &innterapi.CopyAlgorithmVersionRequest{ SpaceId: spaceId, @@ -449,10 +411,7 @@ func (s *AlgorithmService) DownloadAlgorithmVersion(ctx context.Context, req *ap // 新增我的算法 func (s *AlgorithmService) AddMyAlgorithm(ctx context.Context, req *api.AddMyAlgorithmRequest) (*api.AddMyAlgorithmReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.AddAlgorithm(ctx, &innterapi.AddAlgorithmRequest{ SpaceId: spaceId, UserId: userId, @@ -476,10 +435,7 @@ func (s *AlgorithmService) AddMyAlgorithm(ctx context.Context, req *api.AddMyAlg // 上传算法 func (s *AlgorithmService) UploadAlgorithm(ctx context.Context, req *api.UploadAlgorithmRequest) (*api.UploadAlgorithmReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.UploadAlgorithm(ctx, &innterapi.UploadAlgorithmRequest{ SpaceId: spaceId, @@ -500,11 +456,7 @@ func (s *AlgorithmService) UploadAlgorithm(ctx context.Context, req *api.UploadA // 上传算法确认 func (s *AlgorithmService) ConfirmUploadAlgorithm(ctx context.Context, req *api.ConfirmUploadAlgorithmRequest) (*api.ConfirmUploadAlgorithmReply, error) { - - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.ConfirmUploadAlgorithm(ctx, &innterapi.ConfirmUploadAlgorithmRequest{ SpaceId: spaceId, @@ -565,10 +517,7 @@ func (s *AlgorithmService) BatchQueryAlgorithm(ctx context.Context, req *api.Bat // 修改我的算法 func (s *AlgorithmService) UpdateMyAlgorithm(ctx context.Context, req *api.UpdateMyAlgorithmRequest) (*api.UpdateMyAlgorithmReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.UpdateAlgorithm(ctx, &innterapi.UpdateAlgorithmRequest{ SpaceId: spaceId, @@ -591,10 +540,7 @@ func (s *AlgorithmService) UpdateMyAlgorithm(ctx context.Context, req *api.Updat // 修改我的算法版本 func (s *AlgorithmService) UpdatePreAlgorithmVersion(ctx context.Context, req *api.UpdateMyAlgorithmVersionRequest) (*api.UpdateMyAlgorithmVersionReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.AlgorithmClient.UpdateAlgorithmVersion(ctx, &innterapi.UpdateAlgorithmVersionRequest{ SpaceId: spaceId, @@ -685,21 +631,3 @@ func (s *AlgorithmService) myAlgorithmTransfer(ctx context.Context, algorithm *i IsShared: isShared, } } - -func (s *AlgorithmService) getUserIdAndSpaceId(ctx context.Context) (string, string, error) { - userId := commctx.UserIdFromContext(ctx) - if userId == "" { - err := errors.Errorf(nil, errors.ErrorInvalidRequestParameter) - s.log.Errorw(ctx, err) - return "", "", err - } - - session := ss.SessionFromContext(ctx) - if session == nil { - err := errors.Errorf(nil, errors.ErrorUserNoAuthSession) - s.log.Errorw(ctx, err) - return "", "", err - } - - return userId, session.GetWorkspace(), nil -} diff --git a/server/openai-server/internal/service/auth.go b/server/openai-server/internal/service/auth.go index 622525a5..c1256f02 100644 --- a/server/openai-server/internal/service/auth.go +++ b/server/openai-server/internal/service/auth.go @@ -4,11 +4,9 @@ import ( "context" "encoding/base64" innterapi "server/base-server/api/v1" - commctx "server/common/context" "server/common/errors" "server/common/jwt" "server/common/log" - ss "server/common/session" "server/common/utils" api "server/openai-server/api/v1" "server/openai-server/internal/conf" @@ -60,11 +58,13 @@ func (s *AuthService) GetToken(ctx context.Context, req *api.GetTokenRequest) (* } reqBind := &innterapi.Bind{ Platform: req.Bind.Platform, - UserId: string(userId), + UserId: "", UserName: req.Bind.UserName, } + //判断该云脑账号是否已绑定第三方平台的其他账号 rep, err := s.data.UserClient.FindUser(ctx, &innterapi.FindUserRequest{ - Bind: reqBind, + Email: req.Username, + Bind: reqBind, }) if err != nil { return nil, err @@ -72,6 +72,18 @@ func (s *AuthService) GetToken(ctx context.Context, req *api.GetTokenRequest) (* if rep.User != nil { return nil, errors.Errorf(nil, errors.ErrorUserAccountBinded) } + //判断第三方平台账号是否已绑定其他云脑账号 + reqBind.UserId = string(userId) + reps, err := s.data.UserClient.FindUser(ctx, &innterapi.FindUserRequest{ + Bind: reqBind, + }) + if err != nil { + return nil, err + } + if reps.User != nil { + return nil, errors.Errorf(nil, errors.ErrorUserAccountBinded) + } + bindInfo := make([]*innterapi.Bind, 0) bindInfo = append(bindInfo, reqBind) if reply.User.Bind != nil { @@ -88,36 +100,27 @@ func (s *AuthService) GetToken(ctx context.Context, req *api.GetTokenRequest) (* } } //完成绑定 - token, err := jwt.CreateToken(reply.User.Id, s.conf.Server.Http.JwtSecrect, time.Second*time.Duration(s.conf.Service.TokenExpirationSec)) - if err != nil { - return nil, err + // to do check or init user account for old account + checkOrInitUser := &innterapi.CheckOrInitUserRequest{ + Id: reply.User.Id, } - tokenClaim, err := jwt.ParseToken(token, s.conf.Server.Http.JwtSecrect) + _, err = s.data.UserClient.CheckOrInitUser(ctx, checkOrInitUser) if err != nil { return nil, err } - // create user online session - if err = s.data.SessionClient.Create(ctx, &ss.Session{ - Id: reply.User.Id, - UserId: reply.User.Id, - Status: int32(reply.User.Status), - Attributes: make(map[string]string), - CreatedAt: tokenClaim.CreatedAt, - }); err != nil { + + token, err := jwt.CreateToken(reply.User.Id, s.conf.Server.Http.JwtSecrect, time.Second*time.Duration(s.conf.Service.TokenExpirationSec)) + if err != nil { return nil, err } return &api.GetTokenReply{ Token: token, - Expiration: 0, + Expiration: s.conf.Service.TokenExpirationSec, }, nil } func (s *AuthService) DeleteToken(ctx context.Context, req *api.DeleteTokenRequest) (*api.DeleteTokenReply, error) { - userId := commctx.UserIdFromContext(ctx) - if err := s.data.SessionClient.Delete(ctx, userId); err != nil { - return nil, err - } return &api.DeleteTokenReply{}, nil } @@ -146,29 +149,23 @@ func (s *AuthService) RegisterAndBind(ctx context.Context, req *api.RegisterRequ if err != nil { return nil, err } - //生成token - token, err := jwt.CreateToken(newUser.User.Id, s.conf.Server.Http.JwtSecrect, time.Second*time.Duration(s.conf.Service.TokenExpirationSec)) + //初始化用户机时数据 + _, err = s.data.BillingClient.CreateBillingOwner(ctx, &innterapi.CreateBillingOwnerRequest{ + OwnerId: newUser.User.Id, + OwnerType: innterapi.BillingOwnerType_BOT_USER, + }) if err != nil { return nil, err } - tokenClaim, err := jwt.ParseToken(token, s.conf.Server.Http.JwtSecrect) + //生成token + token, err := jwt.CreateToken(newUser.User.Id, s.conf.Server.Http.JwtSecrect, time.Second*time.Duration(s.conf.Service.TokenExpirationSec)) if err != nil { return nil, err } - // create user online session - if err = s.data.SessionClient.Create(ctx, &ss.Session{ - Id: newUser.User.Id, - UserId: newUser.User.Id, - Status: int32(newUser.User.Status), - Attributes: make(map[string]string), - CreatedAt: tokenClaim.CreatedAt, - }); err != nil { - return nil, err - } return &api.RegisterReply{ Token: token, - Expiration: 0, + Expiration: s.conf.Service.TokenExpirationSec, UserId: newUser.User.Id, }, nil } @@ -194,24 +191,10 @@ func (s *AuthService) GetTokenByBind(ctx context.Context, req *api.GetTokenReque if err != nil { return nil, err } - tokenClaim, err := jwt.ParseToken(token, s.conf.Server.Http.JwtSecrect) - if err != nil { - return nil, err - } - // create user online session - if err = s.data.SessionClient.Create(ctx, &ss.Session{ - Id: reply.User.Id, - UserId: reply.User.Id, - Status: int32(reply.User.Status), - Attributes: make(map[string]string), - CreatedAt: tokenClaim.CreatedAt, - }); err != nil { - return nil, err - } return &api.GetTokenReply{ Token: token, - Expiration: 0, + Expiration: s.conf.Service.TokenExpirationSec, }, nil } else { return &api.GetTokenReply{ diff --git a/server/openai-server/internal/service/billing.go b/server/openai-server/internal/service/billing.go index 87ce666e..9dcb1ed3 100644 --- a/server/openai-server/internal/service/billing.go +++ b/server/openai-server/internal/service/billing.go @@ -3,9 +3,9 @@ package service import ( "context" innerapi "server/base-server/api/v1" + commctx "server/common/context" "server/common/errors" "server/common/log" - "server/common/session" api "server/openai-server/api/v1" "server/openai-server/internal/conf" "server/openai-server/internal/data" @@ -33,13 +33,9 @@ func NewBillingService(conf *conf.Bootstrap, logger log.Logger, data *data.Data) } func (s *billingService) GetBillingUser(ctx context.Context, req *api.GetBillingUserRequest) (*api.GetBillingUserReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) owner, err := s.data.BillingClient.GetBillingOwner(ctx, &innerapi.GetBillingOwnerRequest{ - OwnerId: session.UserId, + OwnerId: userId, OwnerType: innerapi.BillingOwnerType_BOT_USER, }) if err != nil { @@ -53,17 +49,13 @@ func (s *billingService) GetBillingUser(ctx context.Context, req *api.GetBilling }}, nil } func (s *billingService) ListUserPayRecord(ctx context.Context, req *api.ListUserPayRecordRequest) (*api.ListUserPayRecordReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.ListBillingPayRecordRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.OwnerId = session.UserId + innerReq.OwnerId = userId innerReq.OwnerType = innerapi.BillingOwnerType_BOT_USER innerReply, err := s.data.BillingClient.ListBillingPayRecord(ctx, innerReq) @@ -80,17 +72,13 @@ func (s *billingService) ListUserPayRecord(ctx context.Context, req *api.ListUse return reply, nil } func (s *billingService) ListUserRechargeRecord(ctx context.Context, req *api.ListUserRechargeRecordRequest) (*api.ListUserRechargeRecordReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.ListBillingRechargeRecordRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.OwnerId = session.UserId + innerReq.OwnerId = userId innerReq.OwnerType = innerapi.BillingOwnerType_BOT_USER innerReply, err := s.data.BillingClient.ListBillingRechargeRecord(ctx, innerReq) @@ -107,13 +95,9 @@ func (s *billingService) ListUserRechargeRecord(ctx context.Context, req *api.Li return reply, nil } func (s *billingService) GetBillingSpace(ctx context.Context, req *api.GetBillingSpaceRequest) (*api.GetBillingSpaceReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - + _, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) owner, err := s.data.BillingClient.GetBillingOwner(ctx, &innerapi.GetBillingOwnerRequest{ - OwnerId: session.GetWorkspace(), + OwnerId: spaceId, OwnerType: innerapi.BillingOwnerType_BOT_SPACE, }) if err != nil { @@ -127,19 +111,15 @@ func (s *billingService) GetBillingSpace(ctx context.Context, req *api.GetBillin }}, nil } func (s *billingService) ListSpacePayRecord(ctx context.Context, req *api.ListSpacePayRecordRequest) (*api.ListSpacePayRecordReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.ListBillingPayRecordRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.OwnerId = session.GetWorkspace() + innerReq.OwnerId = spaceId innerReq.OwnerType = innerapi.BillingOwnerType_BOT_SPACE - innerReq.ExtraInfo = map[string]string{"userId": session.UserId} + innerReq.ExtraInfo = map[string]string{"userId": userId} innerReply, err := s.data.BillingClient.ListBillingPayRecord(ctx, innerReq) if err != nil { @@ -155,17 +135,13 @@ func (s *billingService) ListSpacePayRecord(ctx context.Context, req *api.ListSp return reply, nil } func (s *billingService) ListSpaceRechargeRecord(ctx context.Context, req *api.ListSpaceRechargeRecordRequest) (*api.ListSpaceRechargeRecordReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - + _, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.ListBillingRechargeRecordRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.OwnerId = session.GetWorkspace() + innerReq.OwnerId = spaceId innerReq.OwnerType = innerapi.BillingOwnerType_BOT_SPACE innerReply, err := s.data.BillingClient.ListBillingRechargeRecord(ctx, innerReq) diff --git a/server/openai-server/internal/service/dataset.go b/server/openai-server/internal/service/dataset.go index 54dfd42f..582bd1c2 100644 --- a/server/openai-server/internal/service/dataset.go +++ b/server/openai-server/internal/service/dataset.go @@ -6,8 +6,6 @@ import ( commctx "server/common/context" "server/common/errors" "server/common/log" - "server/common/session" - ss "server/common/session" "server/common/utils/collections/set" api "server/openai-server/api/v1" "server/openai-server/internal/conf" @@ -31,27 +29,27 @@ func NewDatasetService(conf *conf.Bootstrap, logger log.Logger, data *data.Data) } } -func (s *DatasetService) checkDatasetPerm(ctx context.Context, datasetId string, session *session.Session) error { +func (s *DatasetService) checkDatasetPerm(ctx context.Context, datasetId string, userId string) error { reply, err := s.data.DatasetClient.GetDataset(ctx, &innerapi.GetDatasetRequest{Id: datasetId}) if err != nil { return err } - if reply.Dataset.UserId != session.UserId { + if reply.Dataset.UserId != userId { return errors.Errorf(nil, errors.ErrorNotAuthorized) } return nil } -func (s *DatasetService) checkVersionQueryPerm(ctx context.Context, datasetId string, version string, session *session.Session) error { +func (s *DatasetService) checkVersionQueryPerm(ctx context.Context, datasetId string, version string, userId string, spaceId string) error { reply, err := s.data.DatasetClient.GetDatasetVersion(ctx, &innerapi.GetDatasetVersionRequest{DatasetId: datasetId, Version: version}) if err != nil { return err } - if session.UserId != reply.Dataset.UserId && reply.Dataset.SourceType == innerapi.DatasetSourceType_DST_USER { + if userId != reply.Dataset.UserId && reply.Dataset.SourceType == innerapi.DatasetSourceType_DST_USER { hasPerm := false for _, i := range reply.VersionAccesses { - if session.GetWorkspace() == i.SpaceId { + if spaceId == i.SpaceId { hasPerm = true } } @@ -109,14 +107,11 @@ func (s *DatasetService) ListDatasetApply(ctx context.Context, req *api.ListData } func (s *DatasetService) CreateDataset(ctx context.Context, req *api.CreateDatasetRequest) (*api.CreateDatasetReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.CreateDatasetRequest{ - SpaceId: session.GetWorkspace(), - UserId: session.UserId, + SpaceId: spaceId, + UserId: userId, SourceType: innerapi.DatasetSourceType_DST_USER, Name: req.Name, TypeId: req.TypeId, @@ -139,10 +134,7 @@ func (s *DatasetService) CreateDataset(ctx context.Context, req *api.CreateDatas } func (s *DatasetService) ListMyDataset(ctx context.Context, req *api.ListMyDatasetRequest) (*api.ListMyDatasetReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.ListDatasetRequest{} err := copier.Copy(innerReq, req) @@ -150,8 +142,8 @@ func (s *DatasetService) ListMyDataset(ctx context.Context, req *api.ListMyDatas return nil, errors.Errorf(err, errors.ErrorStructCopy) } innerReq.SourceType = innerapi.DatasetSourceType_DST_USER - innerReq.UserId = session.UserId - innerReq.SpaceId = session.GetWorkspace() + innerReq.UserId = userId + innerReq.SpaceId = spaceId innerReply, err := s.data.DatasetClient.ListDataset(ctx, innerReq) if err != nil { @@ -168,11 +160,6 @@ func (s *DatasetService) ListMyDataset(ctx context.Context, req *api.ListMyDatas } func (s *DatasetService) ListPreDataset(ctx context.Context, req *api.ListPreDatasetRequest) (*api.ListPreDatasetReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - innerReq := &innerapi.ListDatasetRequest{} err := copier.Copy(innerReq, req) if err != nil { @@ -195,10 +182,7 @@ func (s *DatasetService) ListPreDataset(ctx context.Context, req *api.ListPreDat } func (s *DatasetService) ListCommDataset(ctx context.Context, req *api.ListCommDatasetRequest) (*api.ListCommDatasetReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + _, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.ListCommDatasetRequest{} err := copier.Copy(innerReq, req) @@ -206,7 +190,7 @@ func (s *DatasetService) ListCommDataset(ctx context.Context, req *api.ListCommD return nil, errors.Errorf(err, errors.ErrorStructCopy) } innerReq.SourceType = innerapi.DatasetSourceType_DST_USER - innerReq.ShareSpaceId = session.GetWorkspace() + innerReq.ShareSpaceId = spaceId innerReply, err := s.data.DatasetClient.ListCommDataset(ctx, innerReq) if err != nil { @@ -251,12 +235,9 @@ func (s *DatasetService) listUserInCond(ctx context.Context, ids []string) (map[ } func (s *DatasetService) DeleteDataset(ctx context.Context, req *api.DeleteDatasetRequest) (*api.DeleteDatasetReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkDatasetPerm(ctx, req.Id, session) + err := s.checkDatasetPerm(ctx, req.Id, userId) if err != nil { return nil, err } @@ -272,12 +253,9 @@ func (s *DatasetService) DeleteDataset(ctx context.Context, req *api.DeleteDatas } func (s *DatasetService) CreateDatasetVersion(ctx context.Context, req *api.CreateDatasetVersionRequest) (*api.CreateDatasetVersionReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkDatasetPerm(ctx, req.DatasetId, session) + err := s.checkDatasetPerm(ctx, req.DatasetId, userId) if err != nil { return nil, err } @@ -297,19 +275,16 @@ func (s *DatasetService) CreateDatasetVersion(ctx context.Context, req *api.Crea } func (s *DatasetService) ListDatasetVersion(ctx context.Context, req *api.ListDatasetVersionRequest) (*api.ListDatasetVersionReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + _, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) if req.Shared { - return s.listCommDatasetVersion(ctx, session, req) + return s.listCommDatasetVersion(ctx, spaceId, req) } else { - return s.listDatasetVersion(ctx, session, req) + return s.listDatasetVersion(ctx, spaceId, req) } } -func (s *DatasetService) listDatasetVersion(ctx context.Context, session *session.Session, req *api.ListDatasetVersionRequest) (*api.ListDatasetVersionReply, error) { +func (s *DatasetService) listDatasetVersion(ctx context.Context, spaceId string, req *api.ListDatasetVersionRequest) (*api.ListDatasetVersionReply, error) { reply := &api.ListDatasetVersionReply{} innerReq := &innerapi.ListDatasetVersionRequest{} @@ -328,7 +303,7 @@ func (s *DatasetService) listDatasetVersion(ctx context.Context, session *sessio if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - commReq.ShareSpaceId = session.GetWorkspace() + commReq.ShareSpaceId = spaceId commReply, err := s.data.DatasetClient.ListCommDatasetVersion(ctx, commReq) if err != nil { return nil, err @@ -351,7 +326,7 @@ func (s *DatasetService) listDatasetVersion(ctx context.Context, session *sessio return reply, nil } -func (s *DatasetService) listCommDatasetVersion(ctx context.Context, session *session.Session, req *api.ListDatasetVersionRequest) (*api.ListDatasetVersionReply, error) { +func (s *DatasetService) listCommDatasetVersion(ctx context.Context, spaceId string, req *api.ListDatasetVersionRequest) (*api.ListDatasetVersionReply, error) { reply := &api.ListDatasetVersionReply{} innerReq := &innerapi.ListCommDatasetVersionRequest{} @@ -359,7 +334,7 @@ func (s *DatasetService) listCommDatasetVersion(ctx context.Context, session *se if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.ShareSpaceId = session.GetWorkspace() + innerReq.ShareSpaceId = spaceId innerReply, err := s.data.DatasetClient.ListCommDatasetVersion(ctx, innerReq) if err != nil { @@ -379,12 +354,9 @@ func (s *DatasetService) listCommDatasetVersion(ctx context.Context, session *se } func (s *DatasetService) DeleteDatasetVersion(ctx context.Context, req *api.DeleteDatasetVersionRequest) (*api.DeleteDatasetVersionReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkDatasetPerm(ctx, req.DatasetId, session) + err := s.checkDatasetPerm(ctx, req.DatasetId, userId) if err != nil { return nil, err } @@ -401,12 +373,9 @@ func (s *DatasetService) DeleteDatasetVersion(ctx context.Context, req *api.Dele } func (s *DatasetService) ShareDatasetVersion(ctx context.Context, req *api.ShareDatasetVersionRequest) (*api.ShareDatasetVersionReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkDatasetPerm(ctx, req.DatasetId, session) + err := s.checkDatasetPerm(ctx, req.DatasetId, userId) if err != nil { return nil, err } @@ -414,7 +383,7 @@ func (s *DatasetService) ShareDatasetVersion(ctx context.Context, req *api.Share reply, err := s.data.DatasetClient.ShareDatasetVersion(ctx, &innerapi.ShareDatasetVersionRequest{ DatasetId: req.DatasetId, Version: req.Version, - ShareSpaceId: session.GetWorkspace(), + ShareSpaceId: spaceId, }) if err != nil { return nil, err @@ -424,12 +393,9 @@ func (s *DatasetService) ShareDatasetVersion(ctx context.Context, req *api.Share } func (s *DatasetService) CloseShareDatasetVersion(ctx context.Context, req *api.CloseShareDatasetVersionRequest) (*api.CloseShareDatasetVersionReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkDatasetPerm(ctx, req.DatasetId, session) + err := s.checkDatasetPerm(ctx, req.DatasetId, userId) if err != nil { return nil, err } @@ -437,7 +403,7 @@ func (s *DatasetService) CloseShareDatasetVersion(ctx context.Context, req *api. reply, err := s.data.DatasetClient.CloseShareDatasetVersion(ctx, &innerapi.CloseShareDatasetVersionRequest{ DatasetId: req.DatasetId, Version: req.Version, - ShareSpaceId: session.GetWorkspace(), + ShareSpaceId: spaceId, }) if err != nil { return nil, err @@ -447,12 +413,9 @@ func (s *DatasetService) CloseShareDatasetVersion(ctx context.Context, req *api. } func (s *DatasetService) ConfirmUploadDatasetVersion(ctx context.Context, req *api.ConfirmUploadDatasetVersionRequest) (*api.ConfirmUploadDatasetVersionReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkDatasetPerm(ctx, req.DatasetId, session) + err := s.checkDatasetPerm(ctx, req.DatasetId, userId) if err != nil { return nil, err } @@ -470,12 +433,9 @@ func (s *DatasetService) ConfirmUploadDatasetVersion(ctx context.Context, req *a } func (s *DatasetService) UploadDatasetVersion(ctx context.Context, req *api.UploadDatasetVersionRequest) (*api.UploadDatasetVersionReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkDatasetPerm(ctx, req.DatasetId, session) + err := s.checkDatasetPerm(ctx, req.DatasetId, userId) if err != nil { return nil, err } @@ -496,12 +456,9 @@ func (s *DatasetService) UploadDatasetVersion(ctx context.Context, req *api.Uplo } func (s *DatasetService) ListDatasetVersionFile(ctx context.Context, req *api.ListDatasetVersionFileRequest) (*api.ListDatasetVersionFileReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkVersionQueryPerm(ctx, req.DatasetId, req.Version, session) + err := s.checkVersionQueryPerm(ctx, req.DatasetId, req.Version, userId, spaceId) if err != nil { return nil, err } @@ -525,10 +482,7 @@ func (s *DatasetService) ListDatasetVersionFile(ctx context.Context, req *api.Li } func (s *DatasetService) UpdateMyDataset(ctx context.Context, req *api.UpdateMyDatasetRequest) (*api.UpdateMyDatasetReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.DatasetClient.UpdateDataset(ctx, &innerapi.UpdateDatasetRequest{ SpaceId: spaceId, @@ -549,10 +503,7 @@ func (s *DatasetService) UpdateMyDataset(ctx context.Context, req *api.UpdateMyD } func (s *DatasetService) UpdateMyDatasetVersion(ctx context.Context, req *api.UpdateMyDatasetVersionRequest) (*api.UpdateMyDatasetVersionReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.DatasetClient.UpdateDatasetVersion(ctx, &innerapi.UpdateDatasetVersionRequest{ SpaceId: spaceId, @@ -570,21 +521,3 @@ func (s *DatasetService) UpdateMyDatasetVersion(ctx context.Context, req *api.Up UpdatedAt: reply.UpdatedAt, }, nil } - -func (s *DatasetService) getUserIdAndSpaceId(ctx context.Context) (string, string, error) { - userId := commctx.UserIdFromContext(ctx) - if userId == "" { - err := errors.Errorf(nil, errors.ErrorInvalidRequestParameter) - s.log.Errorw(ctx, err) - return "", "", err - } - - session := ss.SessionFromContext(ctx) - if session == nil { - err := errors.Errorf(nil, errors.ErrorUserNoAuthSession) - s.log.Errorw(ctx, err) - return "", "", err - } - - return userId, session.GetWorkspace(), nil -} diff --git a/server/openai-server/internal/service/develop.go b/server/openai-server/internal/service/develop.go index 99c1506b..a96400d1 100644 --- a/server/openai-server/internal/service/develop.go +++ b/server/openai-server/internal/service/develop.go @@ -3,9 +3,9 @@ package service import ( "context" innerapi "server/base-server/api/v1" + commctx "server/common/context" "server/common/errors" "server/common/log" - "server/common/session" api "server/openai-server/api/v1" "server/openai-server/internal/conf" "server/openai-server/internal/data" @@ -29,18 +29,15 @@ func NewDevelopService(conf *conf.Bootstrap, logger log.Logger, data *data.Data) } func (s *DevelopService) CreateNotebook(ctx context.Context, req *api.CreateNotebookRequest) (*api.CreateNotebookReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.CreateNotebookRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, err } - innerReq.UserId = session.UserId - innerReq.WorkspaceId = session.GetWorkspace() + innerReq.UserId = userId + innerReq.WorkspaceId = spaceId innerReply, err := s.data.DevelopClient.CreateNotebook(ctx, innerReq) if err != nil { @@ -63,12 +60,9 @@ func (s *DevelopService) checkPermission(ctx context.Context, notebookId string, } func (s *DevelopService) StartNotebook(ctx context.Context, req *api.StartNotebookRequest) (*api.StartNotebookReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkPermission(ctx, req.Id, session.UserId) + err := s.checkPermission(ctx, req.Id, userId) if err != nil { return nil, err } @@ -82,12 +76,9 @@ func (s *DevelopService) StartNotebook(ctx context.Context, req *api.StartNotebo } func (s *DevelopService) StopNotebook(ctx context.Context, req *api.StopNotebookRequest) (*api.StopNotebookReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkPermission(ctx, req.Id, session.UserId) + err := s.checkPermission(ctx, req.Id, userId) if err != nil { return nil, err } @@ -101,12 +92,9 @@ func (s *DevelopService) StopNotebook(ctx context.Context, req *api.StopNotebook } func (s *DevelopService) DeleteNotebook(ctx context.Context, req *api.DeleteNotebookRequest) (*api.DeleteNotebookReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkPermission(ctx, req.Id, session.UserId) + err := s.checkPermission(ctx, req.Id, userId) if err != nil { return nil, err } @@ -120,18 +108,15 @@ func (s *DevelopService) DeleteNotebook(ctx context.Context, req *api.DeleteNote } func (s *DevelopService) ListNotebook(ctx context.Context, req *api.ListNotebookRequest) (*api.ListNotebookReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.ListNotebookRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.UserId = session.UserId - innerReq.WorkspaceId = session.GetWorkspace() + innerReq.UserId = userId + innerReq.WorkspaceId = spaceId innerReply, err := s.data.DevelopClient.ListNotebook(ctx, innerReq) if err != nil { @@ -148,11 +133,6 @@ func (s *DevelopService) ListNotebook(ctx context.Context, req *api.ListNotebook } func (s *DevelopService) QueryNotebook(ctx context.Context, req *api.QueryNotebookRequest) (*api.QueryNotebookReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - innerReq := &innerapi.GetNotebookRequest{} err := copier.Copy(innerReq, req) if err != nil { @@ -175,11 +155,6 @@ func (s *DevelopService) QueryNotebook(ctx context.Context, req *api.QueryNotebo // Notebook事件列表 func (s *DevelopService) GetNotebookEventList(ctx context.Context, req *api.NotebookEventListRequest) (*api.NotebookEventListReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - innerReq := &innerapi.NotebookEventListRequest{} err := copier.Copy(innerReq, req) if err != nil { @@ -201,11 +176,6 @@ func (s *DevelopService) GetNotebookEventList(ctx context.Context, req *api.Note // 保存notebook func (s *DevelopService) SaveNotebook(ctx context.Context, req *api.SaveNotebookRequest) (*api.SaveNotebookReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - sReq := &innerapi.SaveNotebookRequest{ NotebookId: req.NotebookId, TaskName: req.TaskName, @@ -220,12 +190,9 @@ func (s *DevelopService) SaveNotebook(ctx context.Context, req *api.SaveNotebook } func (s *DevelopService) ListNotebookEventRecord(ctx context.Context, req *api.ListNotebookEventRecordRequest) (*api.ListNotebookEventRecordReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkPermission(ctx, req.NotebookId, session.UserId) + err := s.checkPermission(ctx, req.NotebookId, userId) if err != nil { return nil, err } diff --git a/server/openai-server/internal/service/image.go b/server/openai-server/internal/service/image.go index c8d8bf37..6cdfbb5d 100644 --- a/server/openai-server/internal/service/image.go +++ b/server/openai-server/internal/service/image.go @@ -6,7 +6,6 @@ import ( commctx "server/common/context" "server/common/errors" "server/common/log" - ss "server/common/session" "server/common/utils/collections/set" pb "server/openai-server/api/v1" "server/openai-server/internal/conf" @@ -70,11 +69,7 @@ func (s *ImageService) ListPreImage(ctx context.Context, req *pb.ListPreImageReq } func (s *ImageService) ListUserImage(ctx context.Context, req *pb.ListUserImageRequest) (*pb.ListUserImageReply, error) { - userId := commctx.UserIdFromContext(ctx) - session := ss.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ImageClient.ListUserImage(ctx, &innterapi.ListUserImageRequest{ PageSize: req.PageSize, @@ -82,7 +77,7 @@ func (s *ImageService) ListUserImage(ctx context.Context, req *pb.ListUserImageR SortBy: req.SortBy, OrderBy: req.OrderBy, UserId: userId, - SpaceId: session.GetWorkspace(), + SpaceId: spaceId, ImageNameLike: req.ImageNameLike, NameVerLike: req.NameVerLike, SourceType: innterapi.ImageSourceType(req.SourceType), @@ -159,17 +154,14 @@ func (s *ImageService) ListUserImage(ctx context.Context, req *pb.ListUserImageR } func (s *ImageService) ListCommImage(ctx context.Context, req *pb.ListCommImageRequest) (*pb.ListCommImageReply, error) { - session := ss.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + _, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ImageClient.ListCommImage(ctx, &innterapi.ListCommImageRequest{ PageSize: req.PageSize, PageIndex: req.PageIndex, SortBy: req.SortBy, OrderBy: req.OrderBy, - SpaceId: session.GetWorkspace(), + SpaceId: spaceId, ImageNameLike: req.ImageNameLike, NameVerLike: req.NameVerLike, SourceType: innterapi.ImageSourceType(req.SourceType), @@ -223,11 +215,7 @@ func (s *ImageService) ListCommImage(ctx context.Context, req *pb.ListCommImageR } func (s *ImageService) AddImage(ctx context.Context, req *pb.AddImageRequest) (*pb.AddImageReply, error) { - userId := commctx.UserIdFromContext(ctx) - session := ss.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ImageClient.AddImage(ctx, &innterapi.AddImageRequest{ ImageName: req.ImageName, @@ -237,7 +225,7 @@ func (s *ImageService) AddImage(ctx context.Context, req *pb.AddImageRequest) (* SourceType: innterapi.ImageSourceType(req.SourceType), IsPrefab: innterapi.ImageIsPrefab_IMAGE_IS_PREFAB_NO, UserId: userId, - SpaceId: session.GetWorkspace(), + SpaceId: spaceId, }) if err != nil { @@ -320,12 +308,8 @@ func (s *ImageService) UpdateImage(ctx context.Context, req *pb.UpdateImageReque } func (s *ImageService) ShareImage(ctx context.Context, req *pb.ShareImageRequest) (*pb.ShareImageReply, error) { - userId := commctx.UserIdFromContext(ctx) - session := ss.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - reply, err := s.data.ImageClient.ShareImage(ctx, &innterapi.ShareImageRequest{ImageId: req.ImageId, UserId: userId, SpaceId: session.GetWorkspace()}) + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) + reply, err := s.data.ImageClient.ShareImage(ctx, &innterapi.ShareImageRequest{ImageId: req.ImageId, UserId: userId, SpaceId: spaceId}) if err != nil { return nil, err } @@ -333,15 +317,11 @@ func (s *ImageService) ShareImage(ctx context.Context, req *pb.ShareImageRequest } func (s *ImageService) CloseShareImage(ctx context.Context, req *pb.CloseShareImageRequest) (*pb.CloseShareImageReply, error) { - userId := commctx.UserIdFromContext(ctx) - session := ss.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ImageClient.CloseShareImage(ctx, &innterapi.CloseShareImageRequest{ ImageId: req.ImageId, UserId: userId, - SpaceId: session.GetWorkspace(), + SpaceId: spaceId, }) if err != nil { return nil, err diff --git a/server/openai-server/internal/service/jointcloud.go b/server/openai-server/internal/service/jointcloud.go index bbdb4a65..44758334 100644 --- a/server/openai-server/internal/service/jointcloud.go +++ b/server/openai-server/internal/service/jointcloud.go @@ -5,8 +5,6 @@ import ( innerapi "server/base-server/api/v1" commctx "server/common/context" "server/common/errors" - "server/common/session" - ss "server/common/session" api "server/openai-server/api/v1" "server/openai-server/internal/conf" "server/openai-server/internal/data" @@ -136,18 +134,15 @@ func (s *JointCloudService) ListJointCloudInterpreterVersion(ctx context.Context //创建训练任务 func (s *JointCloudService) JointCloudTrainJob(ctx context.Context, req *api.JointCloudTrainJobRequest) (*api.JointCloudTrainJobReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.JointCloudTrainJobRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.UserId = session.UserId - innerReq.WorkspaceId = session.GetWorkspace() + innerReq.UserId = userId + innerReq.WorkspaceId = spaceId innerReply, err := s.data.JointCloudClient.TrainJob(ctx, innerReq) if err != nil { @@ -164,10 +159,7 @@ func (s *JointCloudService) ListJointCloudJob(ctx context.Context, req *api.List return nil, errors.Errorf(err, errors.ErrorStructCopy) } - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq.UserId = userId innerReq.SpaceId = spaceId @@ -188,11 +180,6 @@ func (s *JointCloudService) ListJointCloudJob(ctx context.Context, req *api.List // 停止训练任务 func (s *JointCloudService) StopJob(ctx context.Context, req *api.JointCloudStopJobRequest) (*api.JointCloudStopJobReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - //trainJob, err := s.data.JointCloudClient.GetTrainJobInfo(ctx, &innerapi.TrainJobInfoRequest{Id: req.Id}) //if err != nil { // return nil, err @@ -210,19 +197,3 @@ func (s *JointCloudService) StopJob(ctx context.Context, req *api.JointCloudStop } return &api.JointCloudStopJobReply{StoppedAt: reply.StoppedAt}, nil } - -func (s *JointCloudService) getUserIdAndSpaceId(ctx context.Context) (string, string, error) { - userId := commctx.UserIdFromContext(ctx) - if userId == "" { - err := errors.Errorf(nil, errors.ErrorInvalidRequestParameter) - return "", "", err - } - - session := ss.SessionFromContext(ctx) - if session == nil { - err := errors.Errorf(nil, errors.ErrorUserNoAuthSession) - return "", "", err - } - - return userId, session.GetWorkspace(), nil -} diff --git a/server/openai-server/internal/service/model.go b/server/openai-server/internal/service/model.go index d658584b..64aeac91 100644 --- a/server/openai-server/internal/service/model.go +++ b/server/openai-server/internal/service/model.go @@ -6,7 +6,6 @@ import ( commctx "server/common/context" "server/common/errors" "server/common/log" - ss "server/common/session" api "server/openai-server/api/v1" "server/openai-server/internal/conf" "server/openai-server/internal/data" @@ -61,10 +60,7 @@ func (s *ModelService) ListPreModel(ctx context.Context, req *api.ListPreModelRe // 查询我的模型列表 func (s *ModelService) ListMyModel(ctx context.Context, req *api.ListMyModelRequest) (*api.ListMyModelReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ModelClient.ListMyModel(ctx, &innterapi.ListMyModelRequest{ SpaceId: spaceId, @@ -98,10 +94,7 @@ func (s *ModelService) ListMyModel(ctx context.Context, req *api.ListMyModelRequ // 查询公共模型列表 func (s *ModelService) ListCommModel(ctx context.Context, req *api.ListCommModelRequest) (*api.ListCommModelReply, error) { - _, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + _, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ModelClient.ListCommModel(ctx, &innterapi.ListCommModelRequest{ SpaceId: spaceId, @@ -134,10 +127,7 @@ func (s *ModelService) ListCommModel(ctx context.Context, req *api.ListCommModel // 查询模型版本列表 func (s *ModelService) ListModelVersion(ctx context.Context, req *api.ListModelVersionRequest) (*api.ListModelVersionReply, error) { - _, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + _, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ModelClient.ListModelVersion(ctx, &innterapi.ListModelVersionRequest{ ModelId: req.ModelId, @@ -185,10 +175,7 @@ func (s *ModelService) ListModelVersion(ctx context.Context, req *api.ListModelV // 查询公共模型版本列表 func (s *ModelService) ListCommModelVersion(ctx context.Context, req *api.ListCommModelVersionRequest) (*api.ListCommModelVersionReply, error) { - _, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + _, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ModelClient.ListCommModelVersion(ctx, &innterapi.ListCommModelVersionRequest{ SpaceId: spaceId, @@ -218,10 +205,7 @@ func (s *ModelService) ListCommModelVersion(ctx context.Context, req *api.ListCo // 分享模型版本到公共模型 func (s *ModelService) ShareModelVersion(ctx context.Context, req *api.ShareModelVersionRequest) (*api.ShareModelVersionReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ModelClient.ShareModelVersion(ctx, &innterapi.ShareModelVersionRequest{ SpaceId: spaceId, @@ -241,10 +225,7 @@ func (s *ModelService) ShareModelVersion(ctx context.Context, req *api.ShareMode // 取消分享模型版本到公共模型 func (s *ModelService) CloseShareModelVersion(ctx context.Context, req *api.CloseShareModelVersionRequest) (*api.CloseShareModelVersionReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ModelClient.CloseShareModelVersion(ctx, &innterapi.CloseShareModelVersionRequest{ SpaceId: spaceId, @@ -264,10 +245,7 @@ func (s *ModelService) CloseShareModelVersion(ctx context.Context, req *api.Clos // 删除我的模型版本 func (s *ModelService) DeleteMyModelVersion(ctx context.Context, req *api.DeleteMyModelVersionRequest) (*api.DeleteMyModelVersionReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ModelClient.DeleteMyModelVersion(ctx, &innterapi.DeleteMyModelVersionRequest{ SpaceId: spaceId, @@ -286,10 +264,7 @@ func (s *ModelService) DeleteMyModelVersion(ctx context.Context, req *api.Delete // 删除我的模型 func (s *ModelService) DeleteMyModel(ctx context.Context, req *api.DeleteMyModelRequest) (*api.DeleteMyModelReply, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ModelClient.DeleteMyModel(ctx, &innterapi.DeleteMyModelRequest{ SpaceId: spaceId, @@ -421,29 +396,8 @@ func (s *ModelService) modelVersionTransfer(modelVersion *innterapi.VersionDetai return modelVersionDetail, nil } -func (s *ModelService) getUserIdAndSpaceId(ctx context.Context) (string, string, error) { - userId := commctx.UserIdFromContext(ctx) - if userId == "" { - err := errors.Errorf(nil, errors.ErrorInvalidRequestParameter) - s.log.Errorw(ctx, err) - return "", "", err - } - - session := ss.SessionFromContext(ctx) - if session == nil { - err := errors.Errorf(nil, errors.ErrorUserNoAuthSession) - s.log.Errorw(ctx, err) - return "", "", err - } - - return userId, session.GetWorkspace(), nil -} - func (s *ModelService) viewCtrl(ctx context.Context, modelId string, version string) (bool, error) { - userId, spaceId, err := s.getUserIdAndSpaceId(ctx) - if err != nil { - return false, err - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) reply, err := s.data.ModelClient.QueryModelVersion(ctx, &innterapi.QueryModelVersionRequest{ ModelId: modelId, diff --git a/server/openai-server/internal/service/modeldeploy.go b/server/openai-server/internal/service/modeldeploy.go index 5b6777e5..3015fa1c 100644 --- a/server/openai-server/internal/service/modeldeploy.go +++ b/server/openai-server/internal/service/modeldeploy.go @@ -3,9 +3,9 @@ package service import ( "context" innerapi "server/base-server/api/v1" + commctx "server/common/context" "server/common/errors" "server/common/log" - "server/common/session" api "server/openai-server/api/v1" "server/openai-server/internal/conf" "server/openai-server/internal/data" @@ -30,18 +30,15 @@ func NewModelDeployService(conf *conf.Bootstrap, logger log.Logger, data *data.D //创建模型服务 func (s *ModelDeployService) DeployModel(ctx context.Context, req *api.DepRequest) (*api.DepReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.DepRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.UserId = session.UserId - innerReq.WorkspaceId = session.GetWorkspace() + innerReq.UserId = userId + innerReq.WorkspaceId = spaceId innerReply, err := s.data.ModelDeployClient.DeployModel(ctx, innerReq) if err != nil { @@ -57,16 +54,13 @@ func (s *ModelDeployService) DeployModel(ctx context.Context, req *api.DepReques // 停止模型服务 func (s *ModelDeployService) StopDepModel(ctx context.Context, req *api.StopDepRequest) (*api.StopDepReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) //查询任务是否存在及用户是否一致 depInfo, err := s.data.ModelDeployClient.GetModelDepInfo(ctx, &innerapi.DepInfoRequest{Id: req.Id}) if err != nil { return nil, err } - if depInfo.DepInfo.UserId != session.UserId { + if depInfo.DepInfo.UserId != userId { return nil, errors.Errorf(nil, errors.ErrorNotAuthorized) } innerReq := &innerapi.StopDepRequest{ @@ -82,17 +76,14 @@ func (s *ModelDeployService) StopDepModel(ctx context.Context, req *api.StopDepR //删除模型服务 func (s *ModelDeployService) DeleteDepModel(ctx context.Context, req *api.DeleteDepRequest) (*api.DeleteDepReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkPermission(ctx, req.JobIds, session.UserId) + err := s.checkPermission(ctx, req.JobIds, userId) if err != nil { return nil, err } - innerReq := &innerapi.DeleteDepRequest{UserId: session.UserId, JobIds: req.JobIds} + innerReq := &innerapi.DeleteDepRequest{UserId: userId, JobIds: req.JobIds} reply, err := s.data.ModelDeployClient.DeleteDepModel(ctx, innerReq) if err != nil { return nil, err @@ -117,18 +108,15 @@ func (s *ModelDeployService) checkPermission(ctx context.Context, serviceIds []s // 模型服务调用 func (s *ModelDeployService) ModelServiceInfer(ctx context.Context, req *api.ServiceRequest) (*api.ServiceReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.ServiceRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.UserId = session.UserId - innerReq.WorkspaceId = session.GetWorkspace() + innerReq.UserId = userId + innerReq.WorkspaceId = spaceId innerReply, err := s.data.ModelDeployClient.ModelServiceInfer(ctx, innerReq) if err != nil { @@ -159,10 +147,7 @@ func (s *ModelDeployService) GetModelDepInfo(ctx context.Context, req *api.DepIn // 模型服务列表 func (s *ModelDeployService) ListDepModel(ctx context.Context, req *api.DepListRequest) (*api.DepListReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.DepListRequest{} err := copier.Copy(innerReq, req) @@ -170,8 +155,8 @@ func (s *ModelDeployService) ListDepModel(ctx context.Context, req *api.DepListR return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.UserId = session.UserId - innerReq.WorkspaceId = session.GetWorkspace() + innerReq.UserId = userId + innerReq.WorkspaceId = spaceId innerReply, err := s.data.ModelDeployClient.ListDepModel(ctx, innerReq) if err != nil { diff --git a/server/openai-server/internal/service/resourcespec.go b/server/openai-server/internal/service/resourcespec.go index 63a7c065..16a121fd 100644 --- a/server/openai-server/internal/service/resourcespec.go +++ b/server/openai-server/internal/service/resourcespec.go @@ -3,10 +3,10 @@ package service import ( "context" innerapi "server/base-server/api/v1" + "server/common/constant" commctx "server/common/context" "server/common/errors" "server/common/log" - ss "server/common/session" api "server/openai-server/api/v1" "server/openai-server/internal/conf" "server/openai-server/internal/data" @@ -31,11 +31,8 @@ func NewResourceSpecService(conf *conf.Bootstrap, logger log.Logger, data *data. } func (rsvc *ResourceSpecService) ListResourceSpec(ctx context.Context, req *empty.Empty) (*api.ListResourceSpecReply, error) { - - _, workSpaceId, isDefaultSpace, err := rsvc.getUserIdAndSpaceId(ctx) - if err != nil { - return nil, errors.Errorf(err, errors.ErrorListResourceSpec) - } + var err error + _, workSpaceId, isDefaultSpace := rsvc.getUserIdAndSpaceId(ctx) rq := &innerapi.GetResourcePoolReply{} if isDefaultSpace { @@ -101,20 +98,8 @@ func (rsvc *ResourceSpecService) ListResourceSpec(ctx context.Context, req *empt }, nil } -func (rsvc *ResourceSpecService) getUserIdAndSpaceId(ctx context.Context) (string, string, bool, error) { - userId := commctx.UserIdFromContext(ctx) - if userId == "" { - err := errors.Errorf(nil, errors.ErrorInvalidRequestParameter) - rsvc.log.Errorw(ctx, err) - return "", "", false, err - } - - session := ss.SessionFromContext(ctx) - if session == nil { - err := errors.Errorf(nil, errors.ErrorUserNoAuthSession) - rsvc.log.Errorw(ctx, err) - return "", "", false, err - } +func (rsvc *ResourceSpecService) getUserIdAndSpaceId(ctx context.Context) (string, string, bool) { + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) - return userId, session.GetWorkspace(), session.IsDefaultWorkspace(), nil + return userId, spaceId, spaceId == constant.SYSTEM_WORKSPACE_DEFAULT } diff --git a/server/openai-server/internal/service/trainjob.go b/server/openai-server/internal/service/trainjob.go index 3abd6659..0a1c2868 100644 --- a/server/openai-server/internal/service/trainjob.go +++ b/server/openai-server/internal/service/trainjob.go @@ -3,9 +3,9 @@ package service import ( "context" innerapi "server/base-server/api/v1" + commctx "server/common/context" "server/common/errors" "server/common/log" - "server/common/session" "server/common/utils" api "server/openai-server/api/v1" "server/openai-server/internal/conf" @@ -31,18 +31,15 @@ func NewTrainJobService(conf *conf.Bootstrap, logger log.Logger, data *data.Data //创建训练任务 func (s *TrainJobService) TrainJob(ctx context.Context, req *api.TrainJobRequest) (*api.TrainJobReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.TrainJobRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.UserId = session.UserId - innerReq.WorkspaceId = session.GetWorkspace() + innerReq.UserId = userId + innerReq.WorkspaceId = spaceId innerReply, err := s.data.TrainJobClient.TrainJob(ctx, innerReq) if err != nil { @@ -54,16 +51,14 @@ func (s *TrainJobService) TrainJob(ctx context.Context, req *api.TrainJobRequest // 停止训练任务 func (s *TrainJobService) StopJob(ctx context.Context, req *api.StopJobRequest) (*api.StopJobReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) + //查询任务是否存在及用户是否一直 trainJob, err := s.data.TrainJobClient.GetTrainJobInfo(ctx, &innerapi.TrainJobInfoRequest{Id: req.Id}) if err != nil { return nil, err } - if trainJob.TrainJob.UserId != session.UserId { + if trainJob.TrainJob.UserId != userId { return nil, errors.Errorf(nil, errors.ErrorNotAuthorized) } innerReq := &innerapi.StopJobRequest{ @@ -79,17 +74,14 @@ func (s *TrainJobService) StopJob(ctx context.Context, req *api.StopJobRequest) //删除训练任务 func (s *TrainJobService) DeleteJob(ctx context.Context, req *api.DeleteJobRequest) (*api.DeleteJobReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) - err := s.checkPermission(ctx, req.JobIds, session.UserId) + err := s.checkPermission(ctx, req.JobIds, userId) if err != nil { return nil, err } - innerReq := &innerapi.DeleteJobRequest{UserId: session.UserId, JobIds: req.JobIds} + innerReq := &innerapi.DeleteJobRequest{UserId: userId, JobIds: req.JobIds} reply, err := s.data.TrainJobClient.DeleteJob(ctx, innerReq) if err != nil { return nil, err @@ -100,17 +92,14 @@ func (s *TrainJobService) DeleteJob(ctx context.Context, req *api.DeleteJobReque // 获取训练任务详情 func (s *TrainJobService) GetJobInfo(ctx context.Context, req *api.TrainJobInfoRequest) (*api.TrainJobInfoReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) innerTrainJobInfo, err := s.data.TrainJobClient.GetTrainJobInfo(ctx, &innerapi.TrainJobInfoRequest{Id: req.Id}) if err != nil { return nil, err } - if innerTrainJobInfo.TrainJob.UserId != session.UserId { + if innerTrainJobInfo.TrainJob.UserId != userId { return nil, errors.Errorf(nil, errors.ErrorNotAuthorized) } @@ -130,18 +119,15 @@ func (s *TrainJobService) GetJobInfo(ctx context.Context, req *api.TrainJobInfoR // 训练任务列表 func (s *TrainJobService) TrainJobList(ctx context.Context, req *api.TrainJobListRequest) (*api.TrainJobListReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.TrainJobListRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.UserId = session.UserId - innerReq.WorkspaceId = session.GetWorkspace() + innerReq.UserId = userId + innerReq.WorkspaceId = spaceId innerReply, err := s.data.TrainJobClient.TrainJobList(ctx, innerReq) if err != nil { @@ -171,18 +157,15 @@ func (s *TrainJobService) TrainJobList(ctx context.Context, req *api.TrainJobLis // 创建训练任务模板 func (s *TrainJobService) CreateJobTemplate(ctx context.Context, req *api.TrainJobTemplateRequest) (*api.TrainJobTemplateReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.TrainJobTemplateRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, err } - innerReq.UserId = session.UserId - innerReq.WorkspaceId = session.GetWorkspace() + innerReq.UserId = userId + innerReq.WorkspaceId = spaceId innerReply, err := s.data.TrainJobClient.CreateJobTemplate(ctx, innerReq) if err != nil { @@ -202,21 +185,18 @@ func (s *TrainJobService) CopyJobTemplate(ctx context.Context, req *api.CopyJobT } return &api.CopyJobTemplateReply{ TemplateId: reply.TemplateId, - },nil + }, nil } //获取任务模板信息 func (s *TrainJobService) GetJobTemplate(ctx context.Context, req *api.GetJobTemplateRequest) (*api.GetJobTemplateReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) innerReply, err := s.data.TrainJobClient.GetJobTemplate(ctx, &innerapi.GetJobTemplateRequest{Id: req.Id}) if err != nil { return nil, err } - if innerReply.JobTemplate.UserId != session.UserId { + if innerReply.JobTemplate.UserId != userId { return nil, errors.Errorf(nil, errors.ErrorNotAuthorized) } @@ -236,16 +216,13 @@ func (s *TrainJobService) GetJobTemplate(ctx context.Context, req *api.GetJobTem //更新任务模板 func (s *TrainJobService) UpdateJobTemplate(ctx context.Context, req *api.TrainJobTemplate) (*api.TrainJobTemplateReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) innerJobTemplate, err := s.data.TrainJobClient.GetJobTemplate(ctx, &innerapi.GetJobTemplateRequest{Id: req.Id}) if err != nil { return nil, err } - if innerJobTemplate.JobTemplate.UserId != session.UserId { + if innerJobTemplate.JobTemplate.UserId != userId { return nil, errors.Errorf(nil, errors.ErrorNotAuthorized) } @@ -254,7 +231,7 @@ func (s *TrainJobService) UpdateJobTemplate(ctx context.Context, req *api.TrainJ if err != nil { return nil, err } - innerReq.UserId = session.UserId + innerReq.UserId = userId innerReq.WorkspaceId = innerJobTemplate.JobTemplate.WorkspaceId innerReply, err := s.data.TrainJobClient.UpdateJobTemplate(ctx, innerReq) @@ -269,13 +246,10 @@ func (s *TrainJobService) UpdateJobTemplate(ctx context.Context, req *api.TrainJ // 删除任务模板 func (s *TrainJobService) DeleteTemplate(ctx context.Context, req *api.DeleteJobTemplateRequest) (*api.DeleteJobTemplateReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.DeleteJobTemplateRequest{ - UserId: session.UserId, + UserId: userId, TemplateIds: req.TemplateIds, } @@ -290,18 +264,15 @@ func (s *TrainJobService) DeleteTemplate(ctx context.Context, req *api.DeleteJob // 任务模板列表 func (s *TrainJobService) TrainJobTemplateList(ctx context.Context, req *api.TrainJobTemplateListRequest) (*api.TrainJobTemplateListReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } + userId, spaceId := commctx.UserIdAndSpaceIdFromContext(ctx) innerReq := &innerapi.TrainJobTemplateListRequest{} err := copier.Copy(innerReq, req) if err != nil { return nil, errors.Errorf(err, errors.ErrorStructCopy) } - innerReq.UserId = session.UserId - innerReq.WorkspaceId = session.GetWorkspace() + innerReq.UserId = userId + innerReq.WorkspaceId = spaceId innerReply, err := s.data.TrainJobClient.ListJobTemplate(ctx, innerReq) if err != nil { @@ -475,11 +446,6 @@ func (s *TrainJobService) assignValueToTemplate(ctx context.Context, templates [ // 任务事件列表 func (s *TrainJobService) GetJobEventList(ctx context.Context, req *api.JobEventListRequest) (*api.JobEventListReply, error) { - session := session.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - innerReq := &innerapi.JobEventListRequest{} err := copier.Copy(innerReq, req) if err != nil { diff --git a/server/openai-server/internal/service/user.go b/server/openai-server/internal/service/user.go index d24107cf..fa2b3d9e 100644 --- a/server/openai-server/internal/service/user.go +++ b/server/openai-server/internal/service/user.go @@ -7,7 +7,6 @@ import ( commctx "server/common/context" "server/common/errors" "server/common/log" - ss "server/common/session" api "server/openai-server/api/v1" "server/openai-server/internal/conf" "server/openai-server/internal/data" @@ -43,24 +42,18 @@ func (s *UserService) GetUserInfo(ctx context.Context, req *api.GetUserInfoReque return nil, errors.Errorf(nil, errors.ErrorUserAccountNotExisted) } - session := ss.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - - workspaceId := session.GetWorkspace() return &api.GetUserInfoReply{ User: &api.UserItem{ - Id: reply.User.Id, - CreatedAt: reply.User.CreatedAt, - UpdatedAt: reply.User.UpdatedAt, - FullName: reply.User.FullName, - Email: reply.User.Email, - Phone: reply.User.Phone, - Gender: int32(reply.User.Gender), - Status: int32(reply.User.Status), + Id: reply.User.Id, + CreatedAt: reply.User.CreatedAt, + UpdatedAt: reply.User.UpdatedAt, + FullName: reply.User.FullName, + Email: reply.User.Email, + Phone: reply.User.Phone, + Gender: int32(reply.User.Gender), + Status: int32(reply.User.Status), + FtpUserName: reply.User.FtpUserName, }, - WorkspaceId: workspaceId, }, nil } @@ -99,61 +92,27 @@ func (s *UserService) ListUserWorkspaces(ctx context.Context, req *api.ListUserW }, nil } -func (s *UserService) PutUserWorkspace(ctx context.Context, req *api.PutUserWorkspaceRequest) (*api.PutUserWorkspaceReply, error) { - userId := commctx.UserIdFromContext(ctx) - if userId == "" { - return nil, errors.Errorf(nil, errors.ErrorInvalidRequestParameter) - } - if userId != req.UserId { - return nil, errors.Errorf(nil, errors.ErrorUserIdNotRight) - } - if req.WorkspaceId == "" { - req.WorkspaceId = constant.SYSTEM_WORKSPACE_DEFAULT - } - if req.WorkspaceId != constant.SYSTEM_WORKSPACE_DEFAULT { - // is it having workspace - result, err := s.data.WorkspaceClient.GetWorkspace(ctx, &innterapi.GetWorkspaceRequest{WorkspaceId: req.WorkspaceId}) - if err != nil { - return nil, err - } - if result.Workspace == nil { - return nil, errors.Errorf(nil, errors.ErrorWorkSpaceNotExist) - } - // is it user in workspace - userWorkspaces, err := s.data.WorkspaceClient.ListUserWorkspaces(ctx, &innterapi.ListUserWorkspacesRequest{UserId: userId}) - if err != nil { - return nil, err - } - var isInWorkspace bool - for _, w := range userWorkspaces.Workspaces { - if w.Id == req.WorkspaceId { - isInWorkspace = true - break - } - } - if !isInWorkspace { - return nil, errors.Errorf(nil, errors.ErrorUserWorkSpaceNoPermission) - } - } - - session := ss.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - if err := session.SetWorkspace(req.WorkspaceId); err != nil { +func (s *UserService) GetUserConfig(ctx context.Context, req *api.GetUserConfigRequest) (*api.GetUserConfigReply, error) { + userId, _ := commctx.UserIdAndSpaceIdFromContext(ctx) + reply, err := s.data.UserClient.GetUserConfig(ctx, &innterapi.GetUserConfigRequest{UserId: userId}) + if err != nil { return nil, err } - return &api.PutUserWorkspaceReply{}, nil + return &api.GetUserConfigReply{Config: reply.Config}, nil } -func (s *UserService) GetUserConfig(ctx context.Context, req *api.GetUserConfigRequest) (*api.GetUserConfigReply, error) { - session := ss.SessionFromContext(ctx) - if session == nil { - return nil, errors.Errorf(nil, errors.ErrorUserNoAuthSession) - } - reply, err := s.data.UserClient.GetUserConfig(ctx, &innterapi.GetUserConfigRequest{UserId: session.UserId}) +func (s *UserService) UpdateUserFtpAccount(ctx context.Context, req *api.UpdateUserFtpAccountRequest) (*api.UpdateUserFtpAccountReply, error) { + userId := commctx.UserIdFromContext(ctx) + + _, err := s.data.UserClient.UpdateUserFtpAccount(ctx, &innterapi.UpdateUserFtpAccountRequest{ + FtpPassword: req.FtpPassword, + FtpUserName: req.FtpUserName, + UserId: userId, + }) + if err != nil { return nil, err } - return &api.GetUserConfigReply{Config: reply.Config}, nil + + return &api.UpdateUserFtpAccountReply{}, nil }