diff --git a/go.mod b/go.mod index a4fc3ea64..89833b818 100644 --- a/go.mod +++ b/go.mod @@ -6,13 +6,13 @@ require ( github.com/blang/semver/v4 v4.0.0 github.com/cheggaaa/pb/v3 v3.0.6 github.com/coreos/go-oidc v2.2.1+incompatible - github.com/go-openapi/errors v0.19.6 - github.com/go-openapi/loads v0.19.5 - github.com/go-openapi/runtime v0.19.19 - github.com/go-openapi/spec v0.19.8 - github.com/go-openapi/strfmt v0.19.5 - github.com/go-openapi/swag v0.19.9 - github.com/go-openapi/validate v0.19.10 + github.com/go-openapi/errors v0.19.9 + github.com/go-openapi/loads v0.20.2 + github.com/go-openapi/runtime v0.19.24 + github.com/go-openapi/spec v0.20.3 + github.com/go-openapi/strfmt v0.20.0 + github.com/go-openapi/swag v0.19.14 + github.com/go-openapi/validate v0.20.2 github.com/gorilla/websocket v1.4.2 github.com/jessevdk/go-flags v1.4.0 github.com/minio/cli v1.22.0 diff --git a/go.sum b/go.sum index f80b84635..0c01b5cf9 100644 --- a/go.sum +++ b/go.sum @@ -137,8 +137,9 @@ github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6l github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= -github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 h1:4daAzAu0S6Vi7/lbWECcX0j45yZReDZ56BQsrVBOEEY= github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.16.26/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= @@ -150,6 +151,7 @@ github.com/aws/aws-sdk-go v1.26.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.27.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.31.6/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= +github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -319,40 +321,52 @@ github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpR github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= github.com/go-openapi/analysis v0.19.4/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= -github.com/go-openapi/analysis v0.19.10 h1:5BHISBAXOc/aJK25irLZnx2D3s6WyYaY9D4gmuz9fdE= github.com/go-openapi/analysis v0.19.10/go.mod h1:qmhS3VNFxBlquFJ0RGoDtylO9y4pgTAUNE9AEEMdlJQ= +github.com/go-openapi/analysis v0.19.16/go.mod h1:GLInF007N83Ad3m8a/CbQ5TPzdnGT7workfHwuVjNVk= +github.com/go-openapi/analysis v0.20.0 h1:UN09o0kNhleunxW7LR+KnltD0YrJ8FF03pSqvAN3Vro= +github.com/go-openapi/analysis v0.20.0/go.mod h1:BMchjvaHDykmRMsK40iPtvyOfFdMMxlOmQr9FBZk+Og= github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= github.com/go-openapi/errors v0.19.3/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= -github.com/go-openapi/errors v0.19.6 h1:xZMThgv5SQ7SMbWtKFkCf9bBdvR2iEyw9k3zGZONuys= github.com/go-openapi/errors v0.19.6/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.7/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.9 h1:9SnKdGhiPZHF3ttwFMiCBEb8jQ4IDdrK+5+a0oTygA4= +github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= -github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= -github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/jsonreference v0.19.5 h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM= +github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= github.com/go-openapi/loads v0.19.3/go.mod h1:YVfqhUCdahYwR3f3iiwQLhicVRvLlU/WO5WPaZvcvSI= github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk= -github.com/go-openapi/loads v0.19.5 h1:jZVYWawIQiA1NBnHla28ktg6hrcfTHsCE+3QLVRBIls= github.com/go-openapi/loads v0.19.5/go.mod h1:dswLCAdonkRufe/gSUC3gN8nTSaB9uaS2es0x5/IbjY= +github.com/go-openapi/loads v0.19.6/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hsKvYBNEGVc= +github.com/go-openapi/loads v0.19.7/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hsKvYBNEGVc= +github.com/go-openapi/loads v0.20.0/go.mod h1:2LhKquiE513rN5xC6Aan6lYOSddlL8Mp20AW9kpviM4= +github.com/go-openapi/loads v0.20.2 h1:z5p5Xf5wujMxS1y8aP+vxwW5qYT2zdJBbXKmQUG3lcc= +github.com/go-openapi/loads v0.20.2/go.mod h1:hTVUotJ+UonAMMZsvakEgmWKgtulweO9vYP2bQYKA/o= github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= github.com/go-openapi/runtime v0.19.15/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo= -github.com/go-openapi/runtime v0.19.19 h1:PCaQSqG0HiCgpekchPrHO9AEc5ZUaAclOUp9T3RSKoQ= -github.com/go-openapi/runtime v0.19.19/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pthx8YvyjCfkgk= +github.com/go-openapi/runtime v0.19.16/go.mod h1:5P9104EJgYcizotuXhEuUrzVc+j1RiSjahULvYmlv98= +github.com/go-openapi/runtime v0.19.24 h1:TqagMVlRAOTwllE/7hNKx6rQ10O6T8ZzeJdMjSTKaD4= +github.com/go-openapi/runtime v0.19.24/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pthx8YvyjCfkgk= github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= @@ -360,30 +374,43 @@ github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcs github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= github.com/go-openapi/spec v0.19.5/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= github.com/go-openapi/spec v0.19.6/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= -github.com/go-openapi/spec v0.19.8 h1:qAdZLh1r6QF/hI/gTq+TJTvsQUodZsM7KLqkAJdiJNg= github.com/go-openapi/spec v0.19.8/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= +github.com/go-openapi/spec v0.19.15/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= +github.com/go-openapi/spec v0.20.0/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= +github.com/go-openapi/spec v0.20.1/go.mod h1:93x7oh+d+FQsmsieroS4cmR3u0p/ywH649a3qwC9OsQ= +github.com/go-openapi/spec v0.20.3 h1:uH9RQ6vdyPSs2pSy9fL8QPspDF2AMIMPtmK5coSSjtQ= +github.com/go-openapi/spec v0.20.3/go.mod h1:gG4F8wdEDN+YPBMVnzE85Rbhf+Th2DTvA9nFPQ5AYEg= github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= github.com/go-openapi/strfmt v0.19.4/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= -github.com/go-openapi/strfmt v0.19.5 h1:0utjKrw+BAh8s57XE9Xz8DUBsVvPmRUB6styvl9wWIM= github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= +github.com/go-openapi/strfmt v0.19.11/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= +github.com/go-openapi/strfmt v0.20.0 h1:l2omNtmNbMc39IGptl9BuXBEKcZfS8zjrTsPKTiJiDM= +github.com/go-openapi/strfmt v0.20.0/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= -github.com/go-openapi/swag v0.19.9 h1:1IxuqvBUU3S2Bi4YC7tlP9SJF1gVpCvqN0T2Qof4azE= github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= +github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5HTt47gr72M= +github.com/go-openapi/swag v0.19.13/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng= +github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= -github.com/go-openapi/validate v0.19.10 h1:tG3SZ5DC5KF4cyt7nqLVcQXGj5A7mpaYkAcNPlDK+Yk= github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbNMAuKvKB+IaGx8= +github.com/go-openapi/validate v0.19.12/go.mod h1:Rzou8hA/CBw8donlS6WNEUQupNvUZ0waH08tGe6kAQ4= +github.com/go-openapi/validate v0.19.15/go.mod h1:tbn/fdOwYHgrhPBzidZfJC2MIVvs9GA7monOmWBbeCI= +github.com/go-openapi/validate v0.20.1/go.mod h1:b60iJT+xNNLfaQJUqLI7946tYiFEOuE9E4k54HpKcJ0= +github.com/go-openapi/validate v0.20.2 h1:AhqDegYV3J3iQkMPJSXkvzymHKMTw0BST3RK3hTT4ts= +github.com/go-openapi/validate v0.20.2/go.mod h1:e7OJoKNgd0twXZwIn0A43tHbvIcr/rZIVCbJBpTUoY0= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -699,6 +726,8 @@ github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= @@ -884,8 +913,11 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.3.2 h1:mRS76wmkOn3KkKAyXDu42V+6ebnXWIztFSYGN7GeoRg= github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= @@ -962,6 +994,7 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= @@ -1205,8 +1238,11 @@ go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qL go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.3.0/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= -go.mongodb.org/mongo-driver v1.3.4 h1:zs/dKNwX0gYUtzwrN9lLiR15hCO0nDwQj5xXx+vjCdE= go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= +go.mongodb.org/mongo-driver v1.4.3/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= +go.mongodb.org/mongo-driver v1.4.4/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= +go.mongodb.org/mongo-driver v1.4.6 h1:rh7GdYmDrb8AQSkF8yteAus8qYOgOASWDOv1BWqBXkU= +go.mongodb.org/mongo-driver v1.4.6/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= go.opencensus.io v0.15.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1350,6 +1386,9 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210421230115-4e50805a0758 h1:aEpZnXcAmXkd6AvLb2OPt+EN1Zu/8Ne3pCqPjja5PXY= @@ -1459,6 +1498,7 @@ golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5f golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1683,8 +1723,9 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= diff --git a/models/account_change_password_request.go b/models/account_change_password_request.go index b01857340..927d92fda 100644 --- a/models/account_change_password_request.go +++ b/models/account_change_password_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -79,6 +81,11 @@ func (m *AccountChangePasswordRequest) validateNewSecretKey(formats strfmt.Regis return nil } +// ContextValidate validates this account change password request based on context it is used +func (m *AccountChangePasswordRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AccountChangePasswordRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/add_bucket_lifecycle.go b/models/add_bucket_lifecycle.go index ccc4e3c84..2ba78b6b4 100644 --- a/models/add_bucket_lifecycle.go +++ b/models/add_bucket_lifecycle.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -74,6 +76,11 @@ func (m *AddBucketLifecycle) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this add bucket lifecycle based on context it is used +func (m *AddBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AddBucketLifecycle) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/add_bucket_replication.go b/models/add_bucket_replication.go index 3977edfd0..09d08b5aa 100644 --- a/models/add_bucket_replication.go +++ b/models/add_bucket_replication.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *AddBucketReplication) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this add bucket replication based on context it is used +func (m *AddBucketReplication) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AddBucketReplication) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/add_group_request.go b/models/add_group_request.go index 71ca8a349..f83bc6a50 100644 --- a/models/add_group_request.go +++ b/models/add_group_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -79,6 +81,11 @@ func (m *AddGroupRequest) validateMembers(formats strfmt.Registry) error { return nil } +// ContextValidate validates this add group request based on context it is used +func (m *AddGroupRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AddGroupRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/add_policy_request.go b/models/add_policy_request.go index 52c2bf602..88294dac8 100644 --- a/models/add_policy_request.go +++ b/models/add_policy_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -79,6 +81,11 @@ func (m *AddPolicyRequest) validatePolicy(formats strfmt.Registry) error { return nil } +// ContextValidate validates this add policy request based on context it is used +func (m *AddPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AddPolicyRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/add_user_request.go b/models/add_user_request.go index 55c6b08b7..97a602a10 100644 --- a/models/add_user_request.go +++ b/models/add_user_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -96,6 +98,11 @@ func (m *AddUserRequest) validateSecretKey(formats strfmt.Registry) error { return nil } +// ContextValidate validates this add user request based on context it is used +func (m *AddUserRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AddUserRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/admin_info_response.go b/models/admin_info_response.go index e5bff731b..87481b60c 100644 --- a/models/admin_info_response.go +++ b/models/admin_info_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -63,7 +64,6 @@ func (m *AdminInfoResponse) Validate(formats strfmt.Registry) error { } func (m *AdminInfoResponse) validateWidgets(formats strfmt.Registry) error { - if swag.IsZero(m.Widgets) { // not required return nil } @@ -87,6 +87,38 @@ func (m *AdminInfoResponse) validateWidgets(formats strfmt.Registry) error { return nil } +// ContextValidate validate this admin info response based on the context it is used +func (m *AdminInfoResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateWidgets(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AdminInfoResponse) contextValidateWidgets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Widgets); i++ { + + if m.Widgets[i] != nil { + if err := m.Widgets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("widgets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *AdminInfoResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/arns_response.go b/models/arns_response.go index 35c1a7e25..1ded3d7c8 100644 --- a/models/arns_response.go +++ b/models/arns_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *ArnsResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this arns response based on context it is used +func (m *ArnsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ArnsResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/aws_configuration.go b/models/aws_configuration.go index 67bf4be96..29e8cde6f 100644 --- a/models/aws_configuration.go +++ b/models/aws_configuration.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -71,6 +73,34 @@ func (m *AwsConfiguration) validateSecretsmanager(formats strfmt.Registry) error return nil } +// ContextValidate validate this aws configuration based on the context it is used +func (m *AwsConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSecretsmanager(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AwsConfiguration) contextValidateSecretsmanager(ctx context.Context, formats strfmt.Registry) error { + + if m.Secretsmanager != nil { + if err := m.Secretsmanager.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("secretsmanager") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AwsConfiguration) MarshalBinary() ([]byte, error) { if m == nil { @@ -168,6 +198,34 @@ func (m *AwsConfigurationSecretsmanager) validateRegion(formats strfmt.Registry) return nil } +// ContextValidate validate this aws configuration secretsmanager based on the context it is used +func (m *AwsConfigurationSecretsmanager) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCredentials(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AwsConfigurationSecretsmanager) contextValidateCredentials(ctx context.Context, formats strfmt.Registry) error { + + if m.Credentials != nil { + if err := m.Credentials.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("secretsmanager" + "." + "credentials") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AwsConfigurationSecretsmanager) MarshalBinary() ([]byte, error) { if m == nil { @@ -239,6 +297,11 @@ func (m *AwsConfigurationSecretsmanagerCredentials) validateSecretkey(formats st return nil } +// ContextValidate validates this aws configuration secretsmanager credentials based on context it is used +func (m *AwsConfigurationSecretsmanagerCredentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AwsConfigurationSecretsmanagerCredentials) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bucket.go b/models/bucket.go index 76ca4bacf..ddc6ceee0 100644 --- a/models/bucket.go +++ b/models/bucket.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -35,7 +37,7 @@ import ( type Bucket struct { // access - Access BucketAccess `json:"access,omitempty"` + Access *BucketAccess `json:"access,omitempty"` // creation date CreationDate string `json:"creation_date,omitempty"` @@ -68,16 +70,17 @@ func (m *Bucket) Validate(formats strfmt.Registry) error { } func (m *Bucket) validateAccess(formats strfmt.Registry) error { - if swag.IsZero(m.Access) { // not required return nil } - if err := m.Access.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("access") + if m.Access != nil { + if err := m.Access.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("access") + } + return err } - return err } return nil @@ -89,13 +92,41 @@ func (m *Bucket) validateName(formats strfmt.Registry) error { return err } - if err := validate.MinLength("name", "body", string(*m.Name), 3); err != nil { + if err := validate.MinLength("name", "body", *m.Name, 3); err != nil { return err } return nil } +// ContextValidate validate this bucket based on the context it is used +func (m *Bucket) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccess(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Bucket) contextValidateAccess(ctx context.Context, formats strfmt.Registry) error { + + if m.Access != nil { + if err := m.Access.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("access") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Bucket) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bucket_access.go b/models/bucket_access.go index 78bc40dc2..cfea70d16 100644 --- a/models/bucket_access.go +++ b/models/bucket_access.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -35,6 +36,11 @@ import ( // swagger:model bucketAccess type BucketAccess string +func NewBucketAccess(value BucketAccess) *BucketAccess { + v := value + return &v +} + const ( // BucketAccessPRIVATE captures enum value "PRIVATE" @@ -81,3 +87,8 @@ func (m BucketAccess) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this bucket access based on context it is used +func (m BucketAccess) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/bucket_encryption_info.go b/models/bucket_encryption_info.go index 4e42315e7..0cfc2d8d6 100644 --- a/models/bucket_encryption_info.go +++ b/models/bucket_encryption_info.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *BucketEncryptionInfo) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this bucket encryption info based on context it is used +func (m *BucketEncryptionInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *BucketEncryptionInfo) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bucket_encryption_request.go b/models/bucket_encryption_request.go index b9f8e2895..264a616e7 100644 --- a/models/bucket_encryption_request.go +++ b/models/bucket_encryption_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -34,7 +36,7 @@ import ( type BucketEncryptionRequest struct { // enc type - EncType BucketEncryptionType `json:"encType,omitempty"` + EncType *BucketEncryptionType `json:"encType,omitempty"` // kms key ID KmsKeyID string `json:"kmsKeyID,omitempty"` @@ -55,16 +57,45 @@ func (m *BucketEncryptionRequest) Validate(formats strfmt.Registry) error { } func (m *BucketEncryptionRequest) validateEncType(formats strfmt.Registry) error { - if swag.IsZero(m.EncType) { // not required return nil } - if err := m.EncType.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("encType") + if m.EncType != nil { + if err := m.EncType.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encType") + } + return err + } + } + + return nil +} + +// ContextValidate validate this bucket encryption request based on the context it is used +func (m *BucketEncryptionRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEncType(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BucketEncryptionRequest) contextValidateEncType(ctx context.Context, formats strfmt.Registry) error { + + if m.EncType != nil { + if err := m.EncType.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encType") + } + return err } - return err } return nil diff --git a/models/bucket_encryption_type.go b/models/bucket_encryption_type.go index 6f22dcca3..6425c7944 100644 --- a/models/bucket_encryption_type.go +++ b/models/bucket_encryption_type.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -35,13 +36,18 @@ import ( // swagger:model bucketEncryptionType type BucketEncryptionType string +func NewBucketEncryptionType(value BucketEncryptionType) *BucketEncryptionType { + v := value + return &v +} + const ( - // BucketEncryptionTypeSseS3 captures enum value "sse-s3" - BucketEncryptionTypeSseS3 BucketEncryptionType = "sse-s3" + // BucketEncryptionTypeSseDashS3 captures enum value "sse-s3" + BucketEncryptionTypeSseDashS3 BucketEncryptionType = "sse-s3" - // BucketEncryptionTypeSseKms captures enum value "sse-kms" - BucketEncryptionTypeSseKms BucketEncryptionType = "sse-kms" + // BucketEncryptionTypeSseDashKms captures enum value "sse-kms" + BucketEncryptionTypeSseDashKms BucketEncryptionType = "sse-kms" ) // for schema @@ -78,3 +84,8 @@ func (m BucketEncryptionType) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this bucket encryption type based on context it is used +func (m BucketEncryptionType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/bucket_event_request.go b/models/bucket_event_request.go index 8ce153946..b68babf70 100644 --- a/models/bucket_event_request.go +++ b/models/bucket_event_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -74,6 +76,34 @@ func (m *BucketEventRequest) validateConfiguration(formats strfmt.Registry) erro return nil } +// ContextValidate validate this bucket event request based on the context it is used +func (m *BucketEventRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateConfiguration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BucketEventRequest) contextValidateConfiguration(ctx context.Context, formats strfmt.Registry) error { + + if m.Configuration != nil { + if err := m.Configuration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configuration") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *BucketEventRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bucket_lifecycle_response.go b/models/bucket_lifecycle_response.go index 852561b87..078aa6f5a 100644 --- a/models/bucket_lifecycle_response.go +++ b/models/bucket_lifecycle_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *BucketLifecycleResponse) Validate(formats strfmt.Registry) error { } func (m *BucketLifecycleResponse) validateLifecycle(formats strfmt.Registry) error { - if swag.IsZero(m.Lifecycle) { // not required return nil } @@ -78,6 +78,38 @@ func (m *BucketLifecycleResponse) validateLifecycle(formats strfmt.Registry) err return nil } +// ContextValidate validate this bucket lifecycle response based on the context it is used +func (m *BucketLifecycleResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLifecycle(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BucketLifecycleResponse) contextValidateLifecycle(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Lifecycle); i++ { + + if m.Lifecycle[i] != nil { + if err := m.Lifecycle[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("lifecycle" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *BucketLifecycleResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bucket_ob_locking_response.go b/models/bucket_ob_locking_response.go index ff10888d2..c0dea1a21 100644 --- a/models/bucket_ob_locking_response.go +++ b/models/bucket_ob_locking_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *BucketObLockingResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this bucket ob locking response based on context it is used +func (m *BucketObLockingResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *BucketObLockingResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bucket_object.go b/models/bucket_object.go index c73d82266..6d8689529 100644 --- a/models/bucket_object.go +++ b/models/bucket_object.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -80,6 +82,11 @@ func (m *BucketObject) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this bucket object based on context it is used +func (m *BucketObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *BucketObject) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bucket_quota.go b/models/bucket_quota.go index c27298a1a..badada0da 100644 --- a/models/bucket_quota.go +++ b/models/bucket_quota.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -88,7 +89,6 @@ func (m *BucketQuota) validateTypeEnum(path, location string, value string) erro } func (m *BucketQuota) validateType(formats strfmt.Registry) error { - if swag.IsZero(m.Type) { // not required return nil } @@ -101,6 +101,11 @@ func (m *BucketQuota) validateType(formats strfmt.Registry) error { return nil } +// ContextValidate validates this bucket quota based on context it is used +func (m *BucketQuota) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *BucketQuota) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bucket_replication_destination.go b/models/bucket_replication_destination.go index d99f11dd0..8ae968218 100644 --- a/models/bucket_replication_destination.go +++ b/models/bucket_replication_destination.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *BucketReplicationDestination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this bucket replication destination based on context it is used +func (m *BucketReplicationDestination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *BucketReplicationDestination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bucket_replication_response.go b/models/bucket_replication_response.go index 80eb6bfcb..ad2930756 100644 --- a/models/bucket_replication_response.go +++ b/models/bucket_replication_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *BucketReplicationResponse) Validate(formats strfmt.Registry) error { } func (m *BucketReplicationResponse) validateRules(formats strfmt.Registry) error { - if swag.IsZero(m.Rules) { // not required return nil } @@ -78,6 +78,38 @@ func (m *BucketReplicationResponse) validateRules(formats strfmt.Registry) error return nil } +// ContextValidate validate this bucket replication response based on the context it is used +func (m *BucketReplicationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BucketReplicationResponse) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *BucketReplicationResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bucket_replication_rule.go b/models/bucket_replication_rule.go index 481bd38a6..5a0e91c1d 100644 --- a/models/bucket_replication_rule.go +++ b/models/bucket_replication_rule.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -98,7 +99,6 @@ func (m *BucketReplicationRule) Validate(formats strfmt.Registry) error { } func (m *BucketReplicationRule) validateDestination(formats strfmt.Registry) error { - if swag.IsZero(m.Destination) { // not required return nil } @@ -145,7 +145,6 @@ func (m *BucketReplicationRule) validateStatusEnum(path, location string, value } func (m *BucketReplicationRule) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } @@ -188,7 +187,6 @@ func (m *BucketReplicationRule) validateSyncModeEnum(path, location string, valu } func (m *BucketReplicationRule) validateSyncMode(formats strfmt.Registry) error { - if swag.IsZero(m.SyncMode) { // not required return nil } @@ -201,6 +199,34 @@ func (m *BucketReplicationRule) validateSyncMode(formats strfmt.Registry) error return nil } +// ContextValidate validate this bucket replication rule based on the context it is used +func (m *BucketReplicationRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDestination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BucketReplicationRule) contextValidateDestination(ctx context.Context, formats strfmt.Registry) error { + + if m.Destination != nil { + if err := m.Destination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("destination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *BucketReplicationRule) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bucket_versioning_response.go b/models/bucket_versioning_response.go index 9d2a20ab5..f36a2526c 100644 --- a/models/bucket_versioning_response.go +++ b/models/bucket_versioning_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *BucketVersioningResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this bucket versioning response based on context it is used +func (m *BucketVersioningResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *BucketVersioningResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/bulk_user_groups.go b/models/bulk_user_groups.go index bde23858f..eb41e03b2 100644 --- a/models/bulk_user_groups.go +++ b/models/bulk_user_groups.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -79,6 +81,11 @@ func (m *BulkUserGroups) validateUsers(formats strfmt.Registry) error { return nil } +// ContextValidate validates this bulk user groups based on context it is used +func (m *BulkUserGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *BulkUserGroups) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/change_user_password_request.go b/models/change_user_password_request.go index 6e01ebb1f..40c32c8d5 100644 --- a/models/change_user_password_request.go +++ b/models/change_user_password_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -79,6 +81,11 @@ func (m *ChangeUserPasswordRequest) validateSelectedUser(formats strfmt.Registry return nil } +// ContextValidate validates this change user password request based on context it is used +func (m *ChangeUserPasswordRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ChangeUserPasswordRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/config_description.go b/models/config_description.go index d44e7e862..de36e0bf5 100644 --- a/models/config_description.go +++ b/models/config_description.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *ConfigDescription) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this config description based on context it is used +func (m *ConfigDescription) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ConfigDescription) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/configuration.go b/models/configuration.go index 32e9ceadf..06155474d 100644 --- a/models/configuration.go +++ b/models/configuration.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -57,7 +58,6 @@ func (m *Configuration) Validate(formats strfmt.Registry) error { } func (m *Configuration) validateKeyValues(formats strfmt.Registry) error { - if swag.IsZero(m.KeyValues) { // not required return nil } @@ -81,6 +81,38 @@ func (m *Configuration) validateKeyValues(formats strfmt.Registry) error { return nil } +// ContextValidate validate this configuration based on the context it is used +func (m *Configuration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKeyValues(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Configuration) contextValidateKeyValues(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.KeyValues); i++ { + + if m.KeyValues[i] != nil { + if err := m.KeyValues[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("key_values" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Configuration) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/configuration_k_v.go b/models/configuration_k_v.go index 86bd56b25..c12c3c48b 100644 --- a/models/configuration_k_v.go +++ b/models/configuration_k_v.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *ConfigurationKV) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this configuration k v based on context it is used +func (m *ConfigurationKV) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ConfigurationKV) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/console_configuration.go b/models/console_configuration.go index 235932610..4a351a21a 100644 --- a/models/console_configuration.go +++ b/models/console_configuration.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -98,6 +100,21 @@ func (m *ConsoleConfiguration) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this console configuration based on the context it is used +func (m *ConsoleConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with MetadataFields + if err := m.MetadataFields.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *ConsoleConfiguration) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/create_remote_bucket.go b/models/create_remote_bucket.go index c64adc041..554721b92 100644 --- a/models/create_remote_bucket.go +++ b/models/create_remote_bucket.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -112,7 +113,7 @@ func (m *CreateRemoteBucket) validateAccessKey(formats strfmt.Registry) error { return err } - if err := validate.MinLength("accessKey", "body", string(*m.AccessKey), 3); err != nil { + if err := validate.MinLength("accessKey", "body", *m.AccessKey, 3); err != nil { return err } @@ -125,7 +126,7 @@ func (m *CreateRemoteBucket) validateSecretKey(formats strfmt.Registry) error { return err } - if err := validate.MinLength("secretKey", "body", string(*m.SecretKey), 8); err != nil { + if err := validate.MinLength("secretKey", "body", *m.SecretKey, 8); err != nil { return err } @@ -171,7 +172,6 @@ func (m *CreateRemoteBucket) validateSyncModeEnum(path, location string, value s } func (m *CreateRemoteBucket) validateSyncMode(formats strfmt.Registry) error { - if swag.IsZero(m.SyncMode) { // not required return nil } @@ -202,6 +202,11 @@ func (m *CreateRemoteBucket) validateTargetURL(formats strfmt.Registry) error { return nil } +// ContextValidate validates this create remote bucket based on context it is used +func (m *CreateRemoteBucket) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CreateRemoteBucket) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/create_tenant_request.go b/models/create_tenant_request.go index 00445ae21..f2eae1e49 100644 --- a/models/create_tenant_request.go +++ b/models/create_tenant_request.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -164,7 +165,6 @@ func (m *CreateTenantRequest) Validate(formats strfmt.Registry) error { } func (m *CreateTenantRequest) validateConsole(formats strfmt.Registry) error { - if swag.IsZero(m.Console) { // not required return nil } @@ -182,7 +182,6 @@ func (m *CreateTenantRequest) validateConsole(formats strfmt.Registry) error { } func (m *CreateTenantRequest) validateEncryption(formats strfmt.Registry) error { - if swag.IsZero(m.Encryption) { // not required return nil } @@ -200,7 +199,6 @@ func (m *CreateTenantRequest) validateEncryption(formats strfmt.Registry) error } func (m *CreateTenantRequest) validateIdp(formats strfmt.Registry) error { - if swag.IsZero(m.Idp) { // not required return nil } @@ -218,7 +216,6 @@ func (m *CreateTenantRequest) validateIdp(formats strfmt.Registry) error { } func (m *CreateTenantRequest) validateImageRegistry(formats strfmt.Registry) error { - if swag.IsZero(m.ImageRegistry) { // not required return nil } @@ -236,7 +233,6 @@ func (m *CreateTenantRequest) validateImageRegistry(formats strfmt.Registry) err } func (m *CreateTenantRequest) validateLogSearchConfiguration(formats strfmt.Registry) error { - if swag.IsZero(m.LogSearchConfiguration) { // not required return nil } @@ -259,7 +255,7 @@ func (m *CreateTenantRequest) validateName(formats strfmt.Registry) error { return err } - if err := validate.Pattern("name", "body", string(*m.Name), `^[a-z0-9-]{3,63}$`); err != nil { + if err := validate.Pattern("name", "body", *m.Name, `^[a-z0-9-]{3,63}$`); err != nil { return err } @@ -301,7 +297,6 @@ func (m *CreateTenantRequest) validatePools(formats strfmt.Registry) error { } func (m *CreateTenantRequest) validatePrometheusConfiguration(formats strfmt.Registry) error { - if swag.IsZero(m.PrometheusConfiguration) { // not required return nil } @@ -319,7 +314,6 @@ func (m *CreateTenantRequest) validatePrometheusConfiguration(formats strfmt.Reg } func (m *CreateTenantRequest) validateTLS(formats strfmt.Registry) error { - if swag.IsZero(m.TLS) { // not required return nil } @@ -336,6 +330,164 @@ func (m *CreateTenantRequest) validateTLS(formats strfmt.Registry) error { return nil } +// ContextValidate validate this create tenant request based on the context it is used +func (m *CreateTenantRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateConsole(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateEncryption(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIdp(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateImageRegistry(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLogSearchConfiguration(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePools(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePrometheusConfiguration(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTLS(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateTenantRequest) contextValidateConsole(ctx context.Context, formats strfmt.Registry) error { + + if m.Console != nil { + if err := m.Console.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("console") + } + return err + } + } + + return nil +} + +func (m *CreateTenantRequest) contextValidateEncryption(ctx context.Context, formats strfmt.Registry) error { + + if m.Encryption != nil { + if err := m.Encryption.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encryption") + } + return err + } + } + + return nil +} + +func (m *CreateTenantRequest) contextValidateIdp(ctx context.Context, formats strfmt.Registry) error { + + if m.Idp != nil { + if err := m.Idp.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("idp") + } + return err + } + } + + return nil +} + +func (m *CreateTenantRequest) contextValidateImageRegistry(ctx context.Context, formats strfmt.Registry) error { + + if m.ImageRegistry != nil { + if err := m.ImageRegistry.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("image_registry") + } + return err + } + } + + return nil +} + +func (m *CreateTenantRequest) contextValidateLogSearchConfiguration(ctx context.Context, formats strfmt.Registry) error { + + if m.LogSearchConfiguration != nil { + if err := m.LogSearchConfiguration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("logSearchConfiguration") + } + return err + } + } + + return nil +} + +func (m *CreateTenantRequest) contextValidatePools(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Pools); i++ { + + if m.Pools[i] != nil { + if err := m.Pools[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pools" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CreateTenantRequest) contextValidatePrometheusConfiguration(ctx context.Context, formats strfmt.Registry) error { + + if m.PrometheusConfiguration != nil { + if err := m.PrometheusConfiguration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("prometheusConfiguration") + } + return err + } + } + + return nil +} + +func (m *CreateTenantRequest) contextValidateTLS(ctx context.Context, formats strfmt.Registry) error { + + if m.TLS != nil { + if err := m.TLS.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tls") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CreateTenantRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/create_tenant_response.go b/models/create_tenant_response.go index 44ecb9462..cca684c02 100644 --- a/models/create_tenant_response.go +++ b/models/create_tenant_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *CreateTenantResponse) Validate(formats strfmt.Registry) error { } func (m *CreateTenantResponse) validateConsole(formats strfmt.Registry) error { - if swag.IsZero(m.Console) { // not required return nil } @@ -78,6 +78,38 @@ func (m *CreateTenantResponse) validateConsole(formats strfmt.Registry) error { return nil } +// ContextValidate validate this create tenant response based on the context it is used +func (m *CreateTenantResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateConsole(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateTenantResponse) contextValidateConsole(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Console); i++ { + + if m.Console[i] != nil { + if err := m.Console[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("console" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *CreateTenantResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/csi_format_error_response.go b/models/csi_format_error_response.go index d9a579d44..f1500f1de 100644 --- a/models/csi_format_error_response.go +++ b/models/csi_format_error_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -47,6 +49,11 @@ func (m *CsiFormatErrorResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this csi format error response based on context it is used +func (m *CsiFormatErrorResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CsiFormatErrorResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/delete_tenant_request.go b/models/delete_tenant_request.go index c5acd17fa..a468ea402 100644 --- a/models/delete_tenant_request.go +++ b/models/delete_tenant_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *DeleteTenantRequest) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this delete tenant request based on context it is used +func (m *DeleteTenantRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DeleteTenantRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/direct_c_s_i_drive_info.go b/models/direct_c_s_i_drive_info.go index bc97aa4a7..f80400443 100644 --- a/models/direct_c_s_i_drive_info.go +++ b/models/direct_c_s_i_drive_info.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -59,6 +61,11 @@ func (m *DirectCSIDriveInfo) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this direct c s i drive info based on context it is used +func (m *DirectCSIDriveInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DirectCSIDriveInfo) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/direct_c_s_i_volume_info.go b/models/direct_c_s_i_volume_info.go index 724435cf0..2361c97dc 100644 --- a/models/direct_c_s_i_volume_info.go +++ b/models/direct_c_s_i_volume_info.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -50,6 +52,11 @@ func (m *DirectCSIVolumeInfo) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this direct c s i volume info based on context it is used +func (m *DirectCSIVolumeInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DirectCSIVolumeInfo) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/encryption_configuration.go b/models/encryption_configuration.go index cde529b13..7b85f6be8 100644 --- a/models/encryption_configuration.go +++ b/models/encryption_configuration.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -307,6 +309,129 @@ func (m *EncryptionConfiguration) validateVault(formats strfmt.Registry) error { return nil } +// ContextValidate validate this encryption configuration based on the context it is used +func (m *EncryptionConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with MetadataFields + if err := m.MetadataFields.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAws(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateClient(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGcp(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGemalto(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServer(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVault(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *EncryptionConfiguration) contextValidateAws(ctx context.Context, formats strfmt.Registry) error { + + if m.Aws != nil { + if err := m.Aws.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("aws") + } + return err + } + } + + return nil +} + +func (m *EncryptionConfiguration) contextValidateClient(ctx context.Context, formats strfmt.Registry) error { + + if m.Client != nil { + if err := m.Client.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("client") + } + return err + } + } + + return nil +} + +func (m *EncryptionConfiguration) contextValidateGcp(ctx context.Context, formats strfmt.Registry) error { + + if m.Gcp != nil { + if err := m.Gcp.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gcp") + } + return err + } + } + + return nil +} + +func (m *EncryptionConfiguration) contextValidateGemalto(ctx context.Context, formats strfmt.Registry) error { + + if m.Gemalto != nil { + if err := m.Gemalto.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gemalto") + } + return err + } + } + + return nil +} + +func (m *EncryptionConfiguration) contextValidateServer(ctx context.Context, formats strfmt.Registry) error { + + if m.Server != nil { + if err := m.Server.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("server") + } + return err + } + } + + return nil +} + +func (m *EncryptionConfiguration) contextValidateVault(ctx context.Context, formats strfmt.Registry) error { + + if m.Vault != nil { + if err := m.Vault.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vault") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *EncryptionConfiguration) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/error.go b/models/error.go index 901c4b471..e8bff2186 100644 --- a/models/error.go +++ b/models/error.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -65,6 +67,11 @@ func (m *Error) validateMessage(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/expiration_response.go b/models/expiration_response.go index 90d63808f..394e40974 100644 --- a/models/expiration_response.go +++ b/models/expiration_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -47,6 +49,11 @@ func (m *ExpirationResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this expiration response based on context it is used +func (m *ExpirationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ExpirationResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/format_configuration.go b/models/format_configuration.go index d667ccab2..f5bb7f0f2 100644 --- a/models/format_configuration.go +++ b/models/format_configuration.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -36,7 +38,6 @@ type FormatConfiguration struct { // drives // Required: true - // Min Length: 1 Drives []string `json:"drives"` // force @@ -80,6 +81,11 @@ func (m *FormatConfiguration) validateForce(formats strfmt.Registry) error { return nil } +// ContextValidate validates this format configuration based on context it is used +func (m *FormatConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *FormatConfiguration) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/format_direct_c_s_i_drives_response.go b/models/format_direct_c_s_i_drives_response.go index 76160233c..e7e8c33dd 100644 --- a/models/format_direct_c_s_i_drives_response.go +++ b/models/format_direct_c_s_i_drives_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *FormatDirectCSIDrivesResponse) Validate(formats strfmt.Registry) error } func (m *FormatDirectCSIDrivesResponse) validateFormatIssuesList(formats strfmt.Registry) error { - if swag.IsZero(m.FormatIssuesList) { // not required return nil } @@ -78,6 +78,38 @@ func (m *FormatDirectCSIDrivesResponse) validateFormatIssuesList(formats strfmt. return nil } +// ContextValidate validate this format direct c s i drives response based on the context it is used +func (m *FormatDirectCSIDrivesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFormatIssuesList(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FormatDirectCSIDrivesResponse) contextValidateFormatIssuesList(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.FormatIssuesList); i++ { + + if m.FormatIssuesList[i] != nil { + if err := m.FormatIssuesList[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("formatIssuesList" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *FormatDirectCSIDrivesResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/gcp_configuration.go b/models/gcp_configuration.go index 4c558ac9d..364425047 100644 --- a/models/gcp_configuration.go +++ b/models/gcp_configuration.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -71,6 +73,34 @@ func (m *GcpConfiguration) validateSecretmanager(formats strfmt.Registry) error return nil } +// ContextValidate validate this gcp configuration based on the context it is used +func (m *GcpConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSecretmanager(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GcpConfiguration) contextValidateSecretmanager(ctx context.Context, formats strfmt.Registry) error { + + if m.Secretmanager != nil { + if err := m.Secretmanager.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("secretmanager") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GcpConfiguration) MarshalBinary() ([]byte, error) { if m == nil { @@ -124,7 +154,6 @@ func (m *GcpConfigurationSecretmanager) Validate(formats strfmt.Registry) error } func (m *GcpConfigurationSecretmanager) validateCredentials(formats strfmt.Registry) error { - if swag.IsZero(m.Credentials) { // not required return nil } @@ -150,6 +179,34 @@ func (m *GcpConfigurationSecretmanager) validateProjectID(formats strfmt.Registr return nil } +// ContextValidate validate this gcp configuration secretmanager based on the context it is used +func (m *GcpConfigurationSecretmanager) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCredentials(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GcpConfigurationSecretmanager) contextValidateCredentials(ctx context.Context, formats strfmt.Registry) error { + + if m.Credentials != nil { + if err := m.Credentials.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("secretmanager" + "." + "credentials") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GcpConfigurationSecretmanager) MarshalBinary() ([]byte, error) { if m == nil { @@ -191,6 +248,11 @@ func (m *GcpConfigurationSecretmanagerCredentials) Validate(formats strfmt.Regis return nil } +// ContextValidate validates this gcp configuration secretmanager credentials based on context it is used +func (m *GcpConfigurationSecretmanagerCredentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *GcpConfigurationSecretmanagerCredentials) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/gemalto_configuration.go b/models/gemalto_configuration.go index c1a2e5378..d4316a157 100644 --- a/models/gemalto_configuration.go +++ b/models/gemalto_configuration.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -71,6 +73,34 @@ func (m *GemaltoConfiguration) validateKeysecure(formats strfmt.Registry) error return nil } +// ContextValidate validate this gemalto configuration based on the context it is used +func (m *GemaltoConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKeysecure(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GemaltoConfiguration) contextValidateKeysecure(ctx context.Context, formats strfmt.Registry) error { + + if m.Keysecure != nil { + if err := m.Keysecure.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keysecure") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GemaltoConfiguration) MarshalBinary() ([]byte, error) { if m == nil { @@ -156,7 +186,6 @@ func (m *GemaltoConfigurationKeysecure) validateEndpoint(formats strfmt.Registry } func (m *GemaltoConfigurationKeysecure) validateTLS(formats strfmt.Registry) error { - if swag.IsZero(m.TLS) { // not required return nil } @@ -173,6 +202,52 @@ func (m *GemaltoConfigurationKeysecure) validateTLS(formats strfmt.Registry) err return nil } +// ContextValidate validate this gemalto configuration keysecure based on the context it is used +func (m *GemaltoConfigurationKeysecure) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCredentials(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTLS(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GemaltoConfigurationKeysecure) contextValidateCredentials(ctx context.Context, formats strfmt.Registry) error { + + if m.Credentials != nil { + if err := m.Credentials.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keysecure" + "." + "credentials") + } + return err + } + } + + return nil +} + +func (m *GemaltoConfigurationKeysecure) contextValidateTLS(ctx context.Context, formats strfmt.Registry) error { + + if m.TLS != nil { + if err := m.TLS.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keysecure" + "." + "tls") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GemaltoConfigurationKeysecure) MarshalBinary() ([]byte, error) { if m == nil { @@ -244,6 +319,11 @@ func (m *GemaltoConfigurationKeysecureCredentials) validateToken(formats strfmt. return nil } +// ContextValidate validates this gemalto configuration keysecure credentials based on context it is used +func (m *GemaltoConfigurationKeysecureCredentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *GemaltoConfigurationKeysecureCredentials) MarshalBinary() ([]byte, error) { if m == nil { @@ -295,6 +375,11 @@ func (m *GemaltoConfigurationKeysecureTLS) validateCa(formats strfmt.Registry) e return nil } +// ContextValidate validates this gemalto configuration keysecure TLS based on context it is used +func (m *GemaltoConfigurationKeysecureTLS) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *GemaltoConfigurationKeysecureTLS) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/get_bucket_retention_config.go b/models/get_bucket_retention_config.go index 4dfa2fc96..352eef3e3 100644 --- a/models/get_bucket_retention_config.go +++ b/models/get_bucket_retention_config.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -62,7 +64,6 @@ func (m *GetBucketRetentionConfig) Validate(formats strfmt.Registry) error { } func (m *GetBucketRetentionConfig) validateMode(formats strfmt.Registry) error { - if swag.IsZero(m.Mode) { // not required return nil } @@ -78,7 +79,6 @@ func (m *GetBucketRetentionConfig) validateMode(formats strfmt.Registry) error { } func (m *GetBucketRetentionConfig) validateUnit(formats strfmt.Registry) error { - if swag.IsZero(m.Unit) { // not required return nil } @@ -93,6 +93,48 @@ func (m *GetBucketRetentionConfig) validateUnit(formats strfmt.Registry) error { return nil } +// ContextValidate validate this get bucket retention config based on the context it is used +func (m *GetBucketRetentionConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMode(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUnit(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetBucketRetentionConfig) contextValidateMode(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Mode.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mode") + } + return err + } + + return nil +} + +func (m *GetBucketRetentionConfig) contextValidateUnit(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Unit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unit") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *GetBucketRetentionConfig) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/get_direct_c_s_i_drive_list_response.go b/models/get_direct_c_s_i_drive_list_response.go index e1e431990..256d815b7 100644 --- a/models/get_direct_c_s_i_drive_list_response.go +++ b/models/get_direct_c_s_i_drive_list_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *GetDirectCSIDriveListResponse) Validate(formats strfmt.Registry) error } func (m *GetDirectCSIDriveListResponse) validateDrives(formats strfmt.Registry) error { - if swag.IsZero(m.Drives) { // not required return nil } @@ -78,6 +78,38 @@ func (m *GetDirectCSIDriveListResponse) validateDrives(formats strfmt.Registry) return nil } +// ContextValidate validate this get direct c s i drive list response based on the context it is used +func (m *GetDirectCSIDriveListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDrives(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetDirectCSIDriveListResponse) contextValidateDrives(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Drives); i++ { + + if m.Drives[i] != nil { + if err := m.Drives[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("drives" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *GetDirectCSIDriveListResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/get_direct_c_s_i_volume_list_response.go b/models/get_direct_c_s_i_volume_list_response.go index ea04c163d..c60cf9e27 100644 --- a/models/get_direct_c_s_i_volume_list_response.go +++ b/models/get_direct_c_s_i_volume_list_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *GetDirectCSIVolumeListResponse) Validate(formats strfmt.Registry) error } func (m *GetDirectCSIVolumeListResponse) validateVolumes(formats strfmt.Registry) error { - if swag.IsZero(m.Volumes) { // not required return nil } @@ -78,6 +78,38 @@ func (m *GetDirectCSIVolumeListResponse) validateVolumes(formats strfmt.Registry return nil } +// ContextValidate validate this get direct c s i volume list response based on the context it is used +func (m *GetDirectCSIVolumeListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVolumes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetDirectCSIVolumeListResponse) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Volumes); i++ { + + if m.Volumes[i] != nil { + if err := m.Volumes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *GetDirectCSIVolumeListResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/group.go b/models/group.go index 36481d3e5..e364d3f18 100644 --- a/models/group.go +++ b/models/group.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -50,6 +52,11 @@ func (m *Group) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this group based on context it is used +func (m *Group) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Group) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/has_permission_request.go b/models/has_permission_request.go index dab3706df..4350c89b8 100644 --- a/models/has_permission_request.go +++ b/models/has_permission_request.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *HasPermissionRequest) Validate(formats strfmt.Registry) error { } func (m *HasPermissionRequest) validateActions(formats strfmt.Registry) error { - if swag.IsZero(m.Actions) { // not required return nil } @@ -78,6 +78,38 @@ func (m *HasPermissionRequest) validateActions(formats strfmt.Registry) error { return nil } +// ContextValidate validate this has permission request based on the context it is used +func (m *HasPermissionRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateActions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HasPermissionRequest) contextValidateActions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Actions); i++ { + + if m.Actions[i] != nil { + if err := m.Actions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("actions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *HasPermissionRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/has_permission_response.go b/models/has_permission_response.go index cf72f70cb..3c54075c3 100644 --- a/models/has_permission_response.go +++ b/models/has_permission_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *HasPermissionResponse) Validate(formats strfmt.Registry) error { } func (m *HasPermissionResponse) validatePermissions(formats strfmt.Registry) error { - if swag.IsZero(m.Permissions) { // not required return nil } @@ -78,6 +78,38 @@ func (m *HasPermissionResponse) validatePermissions(formats strfmt.Registry) err return nil } +// ContextValidate validate this has permission response based on the context it is used +func (m *HasPermissionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePermissions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HasPermissionResponse) contextValidatePermissions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Permissions); i++ { + + if m.Permissions[i] != nil { + if err := m.Permissions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("permissions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *HasPermissionResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/iam_entity.go b/models/iam_entity.go index c0547481b..c730b414b 100644 --- a/models/iam_entity.go +++ b/models/iam_entity.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" @@ -46,3 +48,8 @@ func (m IamEntity) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this iam entity based on context it is used +func (m IamEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/idp_configuration.go b/models/idp_configuration.go index 65bd2e054..dd1f1f63e 100644 --- a/models/idp_configuration.go +++ b/models/idp_configuration.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -69,7 +70,6 @@ func (m *IdpConfiguration) Validate(formats strfmt.Registry) error { } func (m *IdpConfiguration) validateActiveDirectory(formats strfmt.Registry) error { - if swag.IsZero(m.ActiveDirectory) { // not required return nil } @@ -87,7 +87,6 @@ func (m *IdpConfiguration) validateActiveDirectory(formats strfmt.Registry) erro } func (m *IdpConfiguration) validateKeys(formats strfmt.Registry) error { - if swag.IsZero(m.Keys) { // not required return nil } @@ -112,7 +111,6 @@ func (m *IdpConfiguration) validateKeys(formats strfmt.Registry) error { } func (m *IdpConfiguration) validateOidc(formats strfmt.Registry) error { - if swag.IsZero(m.Oidc) { // not required return nil } @@ -129,6 +127,74 @@ func (m *IdpConfiguration) validateOidc(formats strfmt.Registry) error { return nil } +// ContextValidate validate this idp configuration based on the context it is used +func (m *IdpConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateActiveDirectory(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeys(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOidc(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IdpConfiguration) contextValidateActiveDirectory(ctx context.Context, formats strfmt.Registry) error { + + if m.ActiveDirectory != nil { + if err := m.ActiveDirectory.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("active_directory") + } + return err + } + } + + return nil +} + +func (m *IdpConfiguration) contextValidateKeys(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Keys); i++ { + + if m.Keys[i] != nil { + if err := m.Keys[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keys" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *IdpConfiguration) contextValidateOidc(ctx context.Context, formats strfmt.Registry) error { + + if m.Oidc != nil { + if err := m.Oidc.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("oidc") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *IdpConfiguration) MarshalBinary() ([]byte, error) { if m == nil { @@ -229,6 +295,11 @@ func (m *IdpConfigurationActiveDirectory) validateUsernameFormat(formats strfmt. return nil } +// ContextValidate validates this idp configuration active directory based on context it is used +func (m *IdpConfigurationActiveDirectory) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *IdpConfigurationActiveDirectory) MarshalBinary() ([]byte, error) { if m == nil { @@ -297,6 +368,11 @@ func (m *IdpConfigurationKeysItems0) validateSecretKey(formats strfmt.Registry) return nil } +// ContextValidate validates this idp configuration keys items0 based on context it is used +func (m *IdpConfigurationKeysItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *IdpConfigurationKeysItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -382,6 +458,11 @@ func (m *IdpConfigurationOidc) validateURL(formats strfmt.Registry) error { return nil } +// ContextValidate validates this idp configuration oidc based on context it is used +func (m *IdpConfigurationOidc) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *IdpConfigurationOidc) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/image_registry.go b/models/image_registry.go index a64c70a31..bc0085f19 100644 --- a/models/image_registry.go +++ b/models/image_registry.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -96,6 +98,11 @@ func (m *ImageRegistry) validateUsername(formats strfmt.Registry) error { return nil } +// ContextValidate validates this image registry based on context it is used +func (m *ImageRegistry) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ImageRegistry) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/key_pair_configuration.go b/models/key_pair_configuration.go index f6d2f7f14..915fd7ff6 100644 --- a/models/key_pair_configuration.go +++ b/models/key_pair_configuration.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -79,6 +81,11 @@ func (m *KeyPairConfiguration) validateKey(formats strfmt.Registry) error { return nil } +// ContextValidate validates this key pair configuration based on context it is used +func (m *KeyPairConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *KeyPairConfiguration) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/license.go b/models/license.go index 700b5dd82..5026ee5e6 100644 --- a/models/license.go +++ b/models/license.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -56,6 +58,11 @@ func (m *License) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this license based on context it is used +func (m *License) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *License) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/lifecycle_tag.go b/models/lifecycle_tag.go index 5de9ba884..589556118 100644 --- a/models/lifecycle_tag.go +++ b/models/lifecycle_tag.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *LifecycleTag) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this lifecycle tag based on context it is used +func (m *LifecycleTag) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LifecycleTag) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/list_bucket_events_response.go b/models/list_bucket_events_response.go index 66970520f..8938959c1 100644 --- a/models/list_bucket_events_response.go +++ b/models/list_bucket_events_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -57,7 +58,6 @@ func (m *ListBucketEventsResponse) Validate(formats strfmt.Registry) error { } func (m *ListBucketEventsResponse) validateEvents(formats strfmt.Registry) error { - if swag.IsZero(m.Events) { // not required return nil } @@ -81,6 +81,38 @@ func (m *ListBucketEventsResponse) validateEvents(formats strfmt.Registry) error return nil } +// ContextValidate validate this list bucket events response based on the context it is used +func (m *ListBucketEventsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEvents(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListBucketEventsResponse) contextValidateEvents(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Events); i++ { + + if m.Events[i] != nil { + if err := m.Events[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("events" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ListBucketEventsResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/list_buckets_response.go b/models/list_buckets_response.go index 34e0ee525..f7c8a01cb 100644 --- a/models/list_buckets_response.go +++ b/models/list_buckets_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -57,7 +58,6 @@ func (m *ListBucketsResponse) Validate(formats strfmt.Registry) error { } func (m *ListBucketsResponse) validateBuckets(formats strfmt.Registry) error { - if swag.IsZero(m.Buckets) { // not required return nil } @@ -81,6 +81,38 @@ func (m *ListBucketsResponse) validateBuckets(formats strfmt.Registry) error { return nil } +// ContextValidate validate this list buckets response based on the context it is used +func (m *ListBucketsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBuckets(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListBucketsResponse) contextValidateBuckets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Buckets); i++ { + + if m.Buckets[i] != nil { + if err := m.Buckets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("buckets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ListBucketsResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/list_config_response.go b/models/list_config_response.go index 5f01adc13..cbb840d17 100644 --- a/models/list_config_response.go +++ b/models/list_config_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -57,7 +58,6 @@ func (m *ListConfigResponse) Validate(formats strfmt.Registry) error { } func (m *ListConfigResponse) validateConfigurations(formats strfmt.Registry) error { - if swag.IsZero(m.Configurations) { // not required return nil } @@ -81,6 +81,38 @@ func (m *ListConfigResponse) validateConfigurations(formats strfmt.Registry) err return nil } +// ContextValidate validate this list config response based on the context it is used +func (m *ListConfigResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateConfigurations(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListConfigResponse) contextValidateConfigurations(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Configurations); i++ { + + if m.Configurations[i] != nil { + if err := m.Configurations[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configurations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ListConfigResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/list_external_buckets_params.go b/models/list_external_buckets_params.go index 6cbcd2e67..c4ff5f888 100644 --- a/models/list_external_buckets_params.go +++ b/models/list_external_buckets_params.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -88,7 +90,7 @@ func (m *ListExternalBucketsParams) validateAccessKey(formats strfmt.Registry) e return err } - if err := validate.MinLength("accessKey", "body", string(*m.AccessKey), 3); err != nil { + if err := validate.MinLength("accessKey", "body", *m.AccessKey, 3); err != nil { return err } @@ -101,7 +103,7 @@ func (m *ListExternalBucketsParams) validateSecretKey(formats strfmt.Registry) e return err } - if err := validate.MinLength("secretKey", "body", string(*m.SecretKey), 8); err != nil { + if err := validate.MinLength("secretKey", "body", *m.SecretKey, 8); err != nil { return err } @@ -126,6 +128,11 @@ func (m *ListExternalBucketsParams) validateUseTLS(formats strfmt.Registry) erro return nil } +// ContextValidate validates this list external buckets params based on context it is used +func (m *ListExternalBucketsParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ListExternalBucketsParams) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/list_groups_response.go b/models/list_groups_response.go index deba3a35b..39a5c915e 100644 --- a/models/list_groups_response.go +++ b/models/list_groups_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *ListGroupsResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this list groups response based on context it is used +func (m *ListGroupsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ListGroupsResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/list_objects_response.go b/models/list_objects_response.go index 0294f84a0..faa4dbc99 100644 --- a/models/list_objects_response.go +++ b/models/list_objects_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -57,7 +58,6 @@ func (m *ListObjectsResponse) Validate(formats strfmt.Registry) error { } func (m *ListObjectsResponse) validateObjects(formats strfmt.Registry) error { - if swag.IsZero(m.Objects) { // not required return nil } @@ -81,6 +81,38 @@ func (m *ListObjectsResponse) validateObjects(formats strfmt.Registry) error { return nil } +// ContextValidate validate this list objects response based on the context it is used +func (m *ListObjectsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateObjects(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListObjectsResponse) contextValidateObjects(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Objects); i++ { + + if m.Objects[i] != nil { + if err := m.Objects[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("objects" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ListObjectsResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/list_p_v_cs_response.go b/models/list_p_v_cs_response.go index e6b447c8e..0952d8c6d 100644 --- a/models/list_p_v_cs_response.go +++ b/models/list_p_v_cs_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *ListPVCsResponse) Validate(formats strfmt.Registry) error { } func (m *ListPVCsResponse) validatePvcs(formats strfmt.Registry) error { - if swag.IsZero(m.Pvcs) { // not required return nil } @@ -78,6 +78,38 @@ func (m *ListPVCsResponse) validatePvcs(formats strfmt.Registry) error { return nil } +// ContextValidate validate this list p v cs response based on the context it is used +func (m *ListPVCsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePvcs(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListPVCsResponse) contextValidatePvcs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Pvcs); i++ { + + if m.Pvcs[i] != nil { + if err := m.Pvcs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvcs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ListPVCsResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/list_policies_response.go b/models/list_policies_response.go index 3edc491f3..3fa7de4a7 100644 --- a/models/list_policies_response.go +++ b/models/list_policies_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -57,7 +58,6 @@ func (m *ListPoliciesResponse) Validate(formats strfmt.Registry) error { } func (m *ListPoliciesResponse) validatePolicies(formats strfmt.Registry) error { - if swag.IsZero(m.Policies) { // not required return nil } @@ -81,6 +81,38 @@ func (m *ListPoliciesResponse) validatePolicies(formats strfmt.Registry) error { return nil } +// ContextValidate validate this list policies response based on the context it is used +func (m *ListPoliciesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePolicies(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListPoliciesResponse) contextValidatePolicies(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Policies); i++ { + + if m.Policies[i] != nil { + if err := m.Policies[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("policies" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ListPoliciesResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/list_remote_buckets_response.go b/models/list_remote_buckets_response.go index 0b2409059..df2a0ec0b 100644 --- a/models/list_remote_buckets_response.go +++ b/models/list_remote_buckets_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -57,7 +58,6 @@ func (m *ListRemoteBucketsResponse) Validate(formats strfmt.Registry) error { } func (m *ListRemoteBucketsResponse) validateBuckets(formats strfmt.Registry) error { - if swag.IsZero(m.Buckets) { // not required return nil } @@ -81,6 +81,38 @@ func (m *ListRemoteBucketsResponse) validateBuckets(formats strfmt.Registry) err return nil } +// ContextValidate validate this list remote buckets response based on the context it is used +func (m *ListRemoteBucketsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBuckets(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListRemoteBucketsResponse) contextValidateBuckets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Buckets); i++ { + + if m.Buckets[i] != nil { + if err := m.Buckets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("buckets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ListRemoteBucketsResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/list_tenants_response.go b/models/list_tenants_response.go index 71e2c4deb..4ef3c59bf 100644 --- a/models/list_tenants_response.go +++ b/models/list_tenants_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -57,7 +58,6 @@ func (m *ListTenantsResponse) Validate(formats strfmt.Registry) error { } func (m *ListTenantsResponse) validateTenants(formats strfmt.Registry) error { - if swag.IsZero(m.Tenants) { // not required return nil } @@ -81,6 +81,38 @@ func (m *ListTenantsResponse) validateTenants(formats strfmt.Registry) error { return nil } +// ContextValidate validate this list tenants response based on the context it is used +func (m *ListTenantsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTenants(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListTenantsResponse) contextValidateTenants(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Tenants); i++ { + + if m.Tenants[i] != nil { + if err := m.Tenants[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tenants" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ListTenantsResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/list_users_response.go b/models/list_users_response.go index c9962654e..931ae7b59 100644 --- a/models/list_users_response.go +++ b/models/list_users_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *ListUsersResponse) Validate(formats strfmt.Registry) error { } func (m *ListUsersResponse) validateUsers(formats strfmt.Registry) error { - if swag.IsZero(m.Users) { // not required return nil } @@ -78,6 +78,38 @@ func (m *ListUsersResponse) validateUsers(formats strfmt.Registry) error { return nil } +// ContextValidate validate this list users response based on the context it is used +func (m *ListUsersResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListUsersResponse) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Users); i++ { + + if m.Users[i] != nil { + if err := m.Users[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ListUsersResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/log_search_configuration.go b/models/log_search_configuration.go index 10ea273ad..f630d7c94 100644 --- a/models/log_search_configuration.go +++ b/models/log_search_configuration.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -50,6 +52,11 @@ func (m *LogSearchConfiguration) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this log search configuration based on context it is used +func (m *LogSearchConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LogSearchConfiguration) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/log_search_response.go b/models/log_search_response.go index e08f7aea1..98575dbd1 100644 --- a/models/log_search_response.go +++ b/models/log_search_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *LogSearchResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this log search response based on context it is used +func (m *LogSearchResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LogSearchResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/login_details.go b/models/login_details.go index 9dc7ccd06..6f8d2c6dd 100644 --- a/models/login_details.go +++ b/models/login_details.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -78,8 +79,8 @@ const ( // LoginDetailsLoginStrategyRedirect captures enum value "redirect" LoginDetailsLoginStrategyRedirect string = "redirect" - // LoginDetailsLoginStrategyServiceAccount captures enum value "service-account" - LoginDetailsLoginStrategyServiceAccount string = "service-account" + // LoginDetailsLoginStrategyServiceDashAccount captures enum value "service-account" + LoginDetailsLoginStrategyServiceDashAccount string = "service-account" ) // prop value enum @@ -91,7 +92,6 @@ func (m *LoginDetails) validateLoginStrategyEnum(path, location string, value st } func (m *LoginDetails) validateLoginStrategy(formats strfmt.Registry) error { - if swag.IsZero(m.LoginStrategy) { // not required return nil } @@ -104,6 +104,11 @@ func (m *LoginDetails) validateLoginStrategy(formats strfmt.Registry) error { return nil } +// ContextValidate validates this login details based on context it is used +func (m *LoginDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LoginDetails) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/login_oauth2_auth_request.go b/models/login_oauth2_auth_request.go index 971f06fd0..f67970643 100644 --- a/models/login_oauth2_auth_request.go +++ b/models/login_oauth2_auth_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -79,6 +81,11 @@ func (m *LoginOauth2AuthRequest) validateState(formats strfmt.Registry) error { return nil } +// ContextValidate validates this login oauth2 auth request based on context it is used +func (m *LoginOauth2AuthRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LoginOauth2AuthRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/login_operator_request.go b/models/login_operator_request.go index a7bab15e9..b6195934a 100644 --- a/models/login_operator_request.go +++ b/models/login_operator_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -62,6 +64,11 @@ func (m *LoginOperatorRequest) validateJwt(formats strfmt.Registry) error { return nil } +// ContextValidate validates this login operator request based on context it is used +func (m *LoginOperatorRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LoginOperatorRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/login_request.go b/models/login_request.go index 64d5e7006..efd9eaa25 100644 --- a/models/login_request.go +++ b/models/login_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -79,6 +81,11 @@ func (m *LoginRequest) validateSecretKey(formats strfmt.Registry) error { return nil } +// ContextValidate validates this login request based on context it is used +func (m *LoginRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LoginRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/login_response.go b/models/login_response.go index de6d70fa5..745f8d497 100644 --- a/models/login_response.go +++ b/models/login_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *LoginResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this login response based on context it is used +func (m *LoginResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LoginResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/make_bucket_request.go b/models/make_bucket_request.go index 1b44aedb9..da85ee5b7 100644 --- a/models/make_bucket_request.go +++ b/models/make_bucket_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -83,7 +85,6 @@ func (m *MakeBucketRequest) validateName(formats strfmt.Registry) error { } func (m *MakeBucketRequest) validateQuota(formats strfmt.Registry) error { - if swag.IsZero(m.Quota) { // not required return nil } @@ -101,7 +102,6 @@ func (m *MakeBucketRequest) validateQuota(formats strfmt.Registry) error { } func (m *MakeBucketRequest) validateRetention(formats strfmt.Registry) error { - if swag.IsZero(m.Retention) { // not required return nil } @@ -118,6 +118,52 @@ func (m *MakeBucketRequest) validateRetention(formats strfmt.Registry) error { return nil } +// ContextValidate validate this make bucket request based on the context it is used +func (m *MakeBucketRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateQuota(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRetention(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MakeBucketRequest) contextValidateQuota(ctx context.Context, formats strfmt.Registry) error { + + if m.Quota != nil { + if err := m.Quota.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("quota") + } + return err + } + } + + return nil +} + +func (m *MakeBucketRequest) contextValidateRetention(ctx context.Context, formats strfmt.Registry) error { + + if m.Retention != nil { + if err := m.Retention.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("retention") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *MakeBucketRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/max_allocatable_mem_response.go b/models/max_allocatable_mem_response.go index d37f79881..8d58ae431 100644 --- a/models/max_allocatable_mem_response.go +++ b/models/max_allocatable_mem_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *MaxAllocatableMemResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this max allocatable mem response based on context it is used +func (m *MaxAllocatableMemResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MaxAllocatableMemResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/metadata_fields.go b/models/metadata_fields.go index ecdc033a5..ab2e38981 100644 --- a/models/metadata_fields.go +++ b/models/metadata_fields.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -47,6 +49,11 @@ func (m *MetadataFields) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this metadata fields based on context it is used +func (m *MetadataFields) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MetadataFields) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/multi_bucket_replication.go b/models/multi_bucket_replication.go index 6b849a0e4..d79cf8762 100644 --- a/models/multi_bucket_replication.go +++ b/models/multi_bucket_replication.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "strconv" @@ -47,7 +48,6 @@ type MultiBucketReplication struct { // buckets relation // Required: true - // Min Length: 1 BucketsRelation []*MultiBucketsRelation `json:"bucketsRelation"` // health check period @@ -121,7 +121,7 @@ func (m *MultiBucketReplication) validateAccessKey(formats strfmt.Registry) erro return err } - if err := validate.MinLength("accessKey", "body", string(*m.AccessKey), 3); err != nil { + if err := validate.MinLength("accessKey", "body", *m.AccessKey, 3); err != nil { return err } @@ -159,7 +159,7 @@ func (m *MultiBucketReplication) validateSecretKey(formats strfmt.Registry) erro return err } - if err := validate.MinLength("secretKey", "body", string(*m.SecretKey), 8); err != nil { + if err := validate.MinLength("secretKey", "body", *m.SecretKey, 8); err != nil { return err } @@ -196,7 +196,6 @@ func (m *MultiBucketReplication) validateSyncModeEnum(path, location string, val } func (m *MultiBucketReplication) validateSyncMode(formats strfmt.Registry) error { - if swag.IsZero(m.SyncMode) { // not required return nil } @@ -218,6 +217,38 @@ func (m *MultiBucketReplication) validateTargetURL(formats strfmt.Registry) erro return nil } +// ContextValidate validate this multi bucket replication based on the context it is used +func (m *MultiBucketReplication) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBucketsRelation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MultiBucketReplication) contextValidateBucketsRelation(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.BucketsRelation); i++ { + + if m.BucketsRelation[i] != nil { + if err := m.BucketsRelation[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bucketsRelation" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *MultiBucketReplication) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/multi_bucket_response_item.go b/models/multi_bucket_response_item.go index b17b40137..55b915718 100644 --- a/models/multi_bucket_response_item.go +++ b/models/multi_bucket_response_item.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -47,6 +49,11 @@ func (m *MultiBucketResponseItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this multi bucket response item based on context it is used +func (m *MultiBucketResponseItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MultiBucketResponseItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/multi_bucket_response_state.go b/models/multi_bucket_response_state.go index 339e94186..624b39e4f 100644 --- a/models/multi_bucket_response_state.go +++ b/models/multi_bucket_response_state.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *MultiBucketResponseState) Validate(formats strfmt.Registry) error { } func (m *MultiBucketResponseState) validateReplicationState(formats strfmt.Registry) error { - if swag.IsZero(m.ReplicationState) { // not required return nil } @@ -78,6 +78,38 @@ func (m *MultiBucketResponseState) validateReplicationState(formats strfmt.Regis return nil } +// ContextValidate validate this multi bucket response state based on the context it is used +func (m *MultiBucketResponseState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateReplicationState(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MultiBucketResponseState) contextValidateReplicationState(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ReplicationState); i++ { + + if m.ReplicationState[i] != nil { + if err := m.ReplicationState[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("replicationState" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *MultiBucketResponseState) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/multi_buckets_relation.go b/models/multi_buckets_relation.go index 6f202e13d..fb99b46e7 100644 --- a/models/multi_buckets_relation.go +++ b/models/multi_buckets_relation.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *MultiBucketsRelation) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this multi buckets relation based on context it is used +func (m *MultiBucketsRelation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MultiBucketsRelation) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/node_labels.go b/models/node_labels.go index 45deec3c9..8d9a2dd3f 100644 --- a/models/node_labels.go +++ b/models/node_labels.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" ) @@ -35,3 +37,8 @@ type NodeLabels map[string][]string func (m NodeLabels) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this node labels based on context it is used +func (m NodeLabels) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/node_selector_term.go b/models/node_selector_term.go index 6557e02a1..7cffb3e5d 100644 --- a/models/node_selector_term.go +++ b/models/node_selector_term.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -62,7 +63,6 @@ func (m *NodeSelectorTerm) Validate(formats strfmt.Registry) error { } func (m *NodeSelectorTerm) validateMatchExpressions(formats strfmt.Registry) error { - if swag.IsZero(m.MatchExpressions) { // not required return nil } @@ -87,7 +87,6 @@ func (m *NodeSelectorTerm) validateMatchExpressions(formats strfmt.Registry) err } func (m *NodeSelectorTerm) validateMatchFields(formats strfmt.Registry) error { - if swag.IsZero(m.MatchFields) { // not required return nil } @@ -111,6 +110,60 @@ func (m *NodeSelectorTerm) validateMatchFields(formats strfmt.Registry) error { return nil } +// ContextValidate validate this node selector term based on the context it is used +func (m *NodeSelectorTerm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMatchExpressions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMatchFields(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NodeSelectorTerm) contextValidateMatchExpressions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MatchExpressions); i++ { + + if m.MatchExpressions[i] != nil { + if err := m.MatchExpressions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("matchExpressions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *NodeSelectorTerm) contextValidateMatchFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MatchFields); i++ { + + if m.MatchFields[i] != nil { + if err := m.MatchFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("matchFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *NodeSelectorTerm) MarshalBinary() ([]byte, error) { if m == nil { @@ -182,6 +235,11 @@ func (m *NodeSelectorTermMatchExpressionsItems0) validateOperator(formats strfmt return nil } +// ContextValidate validates this node selector term match expressions items0 based on context it is used +func (m *NodeSelectorTermMatchExpressionsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NodeSelectorTermMatchExpressionsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -253,6 +311,11 @@ func (m *NodeSelectorTermMatchFieldsItems0) validateOperator(formats strfmt.Regi return nil } +// ContextValidate validates this node selector term match fields items0 based on context it is used +func (m *NodeSelectorTermMatchFieldsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NodeSelectorTermMatchFieldsItems0) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/nofitication_service.go b/models/nofitication_service.go index 1ff68f5a1..08272dc36 100644 --- a/models/nofitication_service.go +++ b/models/nofitication_service.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -35,6 +36,11 @@ import ( // swagger:model nofiticationService type NofiticationService string +func NewNofiticationService(value NofiticationService) *NofiticationService { + v := value + return &v +} + const ( // NofiticationServiceWebhook captures enum value "webhook" @@ -102,3 +108,8 @@ func (m NofiticationService) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this nofitication service based on context it is used +func (m NofiticationService) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/notif_endpoint_response.go b/models/notif_endpoint_response.go index 50ced5944..24c13ac81 100644 --- a/models/notif_endpoint_response.go +++ b/models/notif_endpoint_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *NotifEndpointResponse) Validate(formats strfmt.Registry) error { } func (m *NotifEndpointResponse) validateNotificationEndpoints(formats strfmt.Registry) error { - if swag.IsZero(m.NotificationEndpoints) { // not required return nil } @@ -78,6 +78,38 @@ func (m *NotifEndpointResponse) validateNotificationEndpoints(formats strfmt.Reg return nil } +// ContextValidate validate this notif endpoint response based on the context it is used +func (m *NotifEndpointResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNotificationEndpoints(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NotifEndpointResponse) contextValidateNotificationEndpoints(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.NotificationEndpoints); i++ { + + if m.NotificationEndpoints[i] != nil { + if err := m.NotificationEndpoints[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("notification_endpoints" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *NotifEndpointResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/notification_config.go b/models/notification_config.go index f8dc566ed..8537dd5b1 100644 --- a/models/notification_config.go +++ b/models/notification_config.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -81,7 +82,6 @@ func (m *NotificationConfig) validateArn(formats strfmt.Registry) error { } func (m *NotificationConfig) validateEvents(formats strfmt.Registry) error { - if swag.IsZero(m.Events) { // not required return nil } @@ -100,6 +100,36 @@ func (m *NotificationConfig) validateEvents(formats strfmt.Registry) error { return nil } +// ContextValidate validate this notification config based on the context it is used +func (m *NotificationConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEvents(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NotificationConfig) contextValidateEvents(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Events); i++ { + + if err := m.Events[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("events" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *NotificationConfig) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/notification_delete_request.go b/models/notification_delete_request.go index 59ad64dc2..2b146a870 100644 --- a/models/notification_delete_request.go +++ b/models/notification_delete_request.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -38,7 +39,6 @@ type NotificationDeleteRequest struct { // filter specific type of event. Defaults to all event (default: '[put,delete,get]') // Required: true - // Min Length: 1 Events []NotificationEventType `json:"events"` // filter event associated to the specified prefix @@ -110,6 +110,36 @@ func (m *NotificationDeleteRequest) validateSuffix(formats strfmt.Registry) erro return nil } +// ContextValidate validate this notification delete request based on the context it is used +func (m *NotificationDeleteRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEvents(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NotificationDeleteRequest) contextValidateEvents(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Events); i++ { + + if err := m.Events[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("events" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *NotificationDeleteRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/notification_endpoint.go b/models/notification_endpoint.go index 428f00892..830ea5f96 100644 --- a/models/notification_endpoint.go +++ b/models/notification_endpoint.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -44,7 +46,7 @@ type NotificationEndpoint struct { // service // Required: true - Service NofiticationService `json:"service"` + Service *NofiticationService `json:"service"` } // Validate validates this notification endpoint @@ -80,18 +82,60 @@ func (m *NotificationEndpoint) validateAccountID(formats strfmt.Registry) error func (m *NotificationEndpoint) validateProperties(formats strfmt.Registry) error { + if err := validate.Required("properties", "body", m.Properties); err != nil { + return err + } + return nil } func (m *NotificationEndpoint) validateService(formats strfmt.Registry) error { - if err := m.Service.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("service") - } + if err := validate.Required("service", "body", m.Service); err != nil { return err } + if err := validate.Required("service", "body", m.Service); err != nil { + return err + } + + if m.Service != nil { + if err := m.Service.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service") + } + return err + } + } + + return nil +} + +// ContextValidate validate this notification endpoint based on the context it is used +func (m *NotificationEndpoint) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateService(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NotificationEndpoint) contextValidateService(ctx context.Context, formats strfmt.Registry) error { + + if m.Service != nil { + if err := m.Service.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service") + } + return err + } + } + return nil } diff --git a/models/notification_endpoint_item.go b/models/notification_endpoint_item.go index 460a6cc47..5e73f745c 100644 --- a/models/notification_endpoint_item.go +++ b/models/notification_endpoint_item.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -58,7 +60,6 @@ func (m *NotificationEndpointItem) Validate(formats strfmt.Registry) error { } func (m *NotificationEndpointItem) validateService(formats strfmt.Registry) error { - if swag.IsZero(m.Service) { // not required return nil } @@ -73,6 +74,32 @@ func (m *NotificationEndpointItem) validateService(formats strfmt.Registry) erro return nil } +// ContextValidate validate this notification endpoint item based on the context it is used +func (m *NotificationEndpointItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateService(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NotificationEndpointItem) contextValidateService(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Service.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *NotificationEndpointItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/notification_event_type.go b/models/notification_event_type.go index 64eb7368c..507d0009c 100644 --- a/models/notification_event_type.go +++ b/models/notification_event_type.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -35,6 +36,11 @@ import ( // swagger:model notificationEventType type NotificationEventType string +func NewNotificationEventType(value NotificationEventType) *NotificationEventType { + v := value + return &v +} + const ( // NotificationEventTypePut captures enum value "put" @@ -81,3 +87,8 @@ func (m NotificationEventType) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this notification event type based on context it is used +func (m NotificationEventType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/object_bucket_lifecycle.go b/models/object_bucket_lifecycle.go index d47e84441..e90459791 100644 --- a/models/object_bucket_lifecycle.go +++ b/models/object_bucket_lifecycle.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -77,7 +78,6 @@ func (m *ObjectBucketLifecycle) Validate(formats strfmt.Registry) error { } func (m *ObjectBucketLifecycle) validateExpiration(formats strfmt.Registry) error { - if swag.IsZero(m.Expiration) { // not required return nil } @@ -95,7 +95,6 @@ func (m *ObjectBucketLifecycle) validateExpiration(formats strfmt.Registry) erro } func (m *ObjectBucketLifecycle) validateTags(formats strfmt.Registry) error { - if swag.IsZero(m.Tags) { // not required return nil } @@ -120,7 +119,6 @@ func (m *ObjectBucketLifecycle) validateTags(formats strfmt.Registry) error { } func (m *ObjectBucketLifecycle) validateTransition(formats strfmt.Registry) error { - if swag.IsZero(m.Transition) { // not required return nil } @@ -137,6 +135,74 @@ func (m *ObjectBucketLifecycle) validateTransition(formats strfmt.Registry) erro return nil } +// ContextValidate validate this object bucket lifecycle based on the context it is used +func (m *ObjectBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateExpiration(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTags(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTransition(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ObjectBucketLifecycle) contextValidateExpiration(ctx context.Context, formats strfmt.Registry) error { + + if m.Expiration != nil { + if err := m.Expiration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("expiration") + } + return err + } + } + + return nil +} + +func (m *ObjectBucketLifecycle) contextValidateTags(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Tags); i++ { + + if m.Tags[i] != nil { + if err := m.Tags[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ObjectBucketLifecycle) contextValidateTransition(ctx context.Context, formats strfmt.Registry) error { + + if m.Transition != nil { + if err := m.Transition.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("transition") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ObjectBucketLifecycle) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/object_legal_hold_status.go b/models/object_legal_hold_status.go index 41c9eddcc..0af1f578a 100644 --- a/models/object_legal_hold_status.go +++ b/models/object_legal_hold_status.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -35,6 +36,11 @@ import ( // swagger:model objectLegalHoldStatus type ObjectLegalHoldStatus string +func NewObjectLegalHoldStatus(value ObjectLegalHoldStatus) *ObjectLegalHoldStatus { + v := value + return &v +} + const ( // ObjectLegalHoldStatusEnabled captures enum value "enabled" @@ -78,3 +84,8 @@ func (m ObjectLegalHoldStatus) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this object legal hold status based on context it is used +func (m ObjectLegalHoldStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/object_retention_mode.go b/models/object_retention_mode.go index 4edd8c53b..d828e81e6 100644 --- a/models/object_retention_mode.go +++ b/models/object_retention_mode.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -35,6 +36,11 @@ import ( // swagger:model objectRetentionMode type ObjectRetentionMode string +func NewObjectRetentionMode(value ObjectRetentionMode) *ObjectRetentionMode { + v := value + return &v +} + const ( // ObjectRetentionModeGovernance captures enum value "governance" @@ -78,3 +84,8 @@ func (m ObjectRetentionMode) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this object retention mode based on context it is used +func (m ObjectRetentionMode) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/object_retention_unit.go b/models/object_retention_unit.go index b239d2b02..dcb7c0861 100644 --- a/models/object_retention_unit.go +++ b/models/object_retention_unit.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -35,6 +36,11 @@ import ( // swagger:model objectRetentionUnit type ObjectRetentionUnit string +func NewObjectRetentionUnit(value ObjectRetentionUnit) *ObjectRetentionUnit { + v := value + return &v +} + const ( // ObjectRetentionUnitDays captures enum value "days" @@ -78,3 +84,8 @@ func (m ObjectRetentionUnit) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this object retention unit based on context it is used +func (m ObjectRetentionUnit) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/parity_response.go b/models/parity_response.go index dd792a1cc..ae0f97928 100644 --- a/models/parity_response.go +++ b/models/parity_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" ) @@ -35,3 +37,8 @@ type ParityResponse []string func (m ParityResponse) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this parity response based on context it is used +func (m ParityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/permission_action.go b/models/permission_action.go index d84563742..c2fe94d11 100644 --- a/models/permission_action.go +++ b/models/permission_action.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *PermissionAction) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this permission action based on context it is used +func (m *PermissionAction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PermissionAction) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/pod_affinity_term.go b/models/pod_affinity_term.go index 8136275fe..5475f3f6a 100644 --- a/models/pod_affinity_term.go +++ b/models/pod_affinity_term.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -66,7 +67,6 @@ func (m *PodAffinityTerm) Validate(formats strfmt.Registry) error { } func (m *PodAffinityTerm) validateLabelSelector(formats strfmt.Registry) error { - if swag.IsZero(m.LabelSelector) { // not required return nil } @@ -92,6 +92,34 @@ func (m *PodAffinityTerm) validateTopologyKey(formats strfmt.Registry) error { return nil } +// ContextValidate validate this pod affinity term based on the context it is used +func (m *PodAffinityTerm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLabelSelector(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PodAffinityTerm) contextValidateLabelSelector(ctx context.Context, formats strfmt.Registry) error { + + if m.LabelSelector != nil { + if err := m.LabelSelector.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("labelSelector") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PodAffinityTerm) MarshalBinary() ([]byte, error) { if m == nil { @@ -137,7 +165,6 @@ func (m *PodAffinityTermLabelSelector) Validate(formats strfmt.Registry) error { } func (m *PodAffinityTermLabelSelector) validateMatchExpressions(formats strfmt.Registry) error { - if swag.IsZero(m.MatchExpressions) { // not required return nil } @@ -161,6 +188,38 @@ func (m *PodAffinityTermLabelSelector) validateMatchExpressions(formats strfmt.R return nil } +// ContextValidate validate this pod affinity term label selector based on the context it is used +func (m *PodAffinityTermLabelSelector) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMatchExpressions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PodAffinityTermLabelSelector) contextValidateMatchExpressions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MatchExpressions); i++ { + + if m.MatchExpressions[i] != nil { + if err := m.MatchExpressions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("labelSelector" + "." + "matchExpressions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PodAffinityTermLabelSelector) MarshalBinary() ([]byte, error) { if m == nil { @@ -232,6 +291,11 @@ func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) validateOperator(fo return nil } +// ContextValidate validates this pod affinity term label selector match expressions items0 based on context it is used +func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PodAffinityTermLabelSelectorMatchExpressionsItems0) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/policy.go b/models/policy.go index 94d9bdd5d..12f350efb 100644 --- a/models/policy.go +++ b/models/policy.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *Policy) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this policy based on context it is used +func (m *Policy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Policy) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/policy_args.go b/models/policy_args.go index 91d76b5c5..72223d5be 100644 --- a/models/policy_args.go +++ b/models/policy_args.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -47,6 +49,11 @@ func (m *PolicyArgs) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this policy args based on context it is used +func (m *PolicyArgs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PolicyArgs) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/policy_entity.go b/models/policy_entity.go index afb55af50..6b21a14fa 100644 --- a/models/policy_entity.go +++ b/models/policy_entity.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -35,6 +36,11 @@ import ( // swagger:model policyEntity type PolicyEntity string +func NewPolicyEntity(value PolicyEntity) *PolicyEntity { + v := value + return &v +} + const ( // PolicyEntityUser captures enum value "user" @@ -78,3 +84,8 @@ func (m PolicyEntity) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this policy entity based on context it is used +func (m PolicyEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/pool.go b/models/pool.go index 32f3df3a7..aaa8d3750 100644 --- a/models/pool.go +++ b/models/pool.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -97,7 +99,6 @@ func (m *Pool) Validate(formats strfmt.Registry) error { } func (m *Pool) validateAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.Affinity) { // not required return nil } @@ -115,7 +116,6 @@ func (m *Pool) validateAffinity(formats strfmt.Registry) error { } func (m *Pool) validateResources(formats strfmt.Registry) error { - if swag.IsZero(m.Resources) { // not required return nil } @@ -142,7 +142,6 @@ func (m *Pool) validateServers(formats strfmt.Registry) error { } func (m *Pool) validateTolerations(formats strfmt.Registry) error { - if swag.IsZero(m.Tolerations) { // not required return nil } @@ -184,6 +183,86 @@ func (m *Pool) validateVolumesPerServer(formats strfmt.Registry) error { return nil } +// ContextValidate validate this pool based on the context it is used +func (m *Pool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateResources(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTolerations(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVolumeConfiguration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Pool) contextValidateAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.Affinity != nil { + if err := m.Affinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("affinity") + } + return err + } + } + + return nil +} + +func (m *Pool) contextValidateResources(ctx context.Context, formats strfmt.Registry) error { + + if m.Resources != nil { + if err := m.Resources.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("resources") + } + return err + } + } + + return nil +} + +func (m *Pool) contextValidateTolerations(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Tolerations.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tolerations") + } + return err + } + + return nil +} + +func (m *Pool) contextValidateVolumeConfiguration(ctx context.Context, formats strfmt.Registry) error { + + if m.VolumeConfiguration != nil { + if err := m.VolumeConfiguration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volume_configuration") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Pool) MarshalBinary() ([]byte, error) { if m == nil { @@ -244,6 +323,11 @@ func (m *PoolVolumeConfiguration) validateSize(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pool volume configuration based on context it is used +func (m *PoolVolumeConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PoolVolumeConfiguration) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/pool_affinity.go b/models/pool_affinity.go index 47e5ce33a..f358ee594 100644 --- a/models/pool_affinity.go +++ b/models/pool_affinity.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -69,7 +70,6 @@ func (m *PoolAffinity) Validate(formats strfmt.Registry) error { } func (m *PoolAffinity) validateNodeAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.NodeAffinity) { // not required return nil } @@ -87,7 +87,6 @@ func (m *PoolAffinity) validateNodeAffinity(formats strfmt.Registry) error { } func (m *PoolAffinity) validatePodAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.PodAffinity) { // not required return nil } @@ -105,7 +104,6 @@ func (m *PoolAffinity) validatePodAffinity(formats strfmt.Registry) error { } func (m *PoolAffinity) validatePodAntiAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.PodAntiAffinity) { // not required return nil } @@ -122,6 +120,70 @@ func (m *PoolAffinity) validatePodAntiAffinity(formats strfmt.Registry) error { return nil } +// ContextValidate validate this pool affinity based on the context it is used +func (m *PoolAffinity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNodeAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePodAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePodAntiAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PoolAffinity) contextValidateNodeAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.NodeAffinity != nil { + if err := m.NodeAffinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("nodeAffinity") + } + return err + } + } + + return nil +} + +func (m *PoolAffinity) contextValidatePodAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.PodAffinity != nil { + if err := m.PodAffinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("podAffinity") + } + return err + } + } + + return nil +} + +func (m *PoolAffinity) contextValidatePodAntiAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.PodAntiAffinity != nil { + if err := m.PodAntiAffinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("podAntiAffinity") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PoolAffinity) MarshalBinary() ([]byte, error) { if m == nil { @@ -171,7 +233,6 @@ func (m *PoolAffinityNodeAffinity) Validate(formats strfmt.Registry) error { } func (m *PoolAffinityNodeAffinity) validatePreferredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution) { // not required return nil } @@ -196,7 +257,6 @@ func (m *PoolAffinityNodeAffinity) validatePreferredDuringSchedulingIgnoredDurin } func (m *PoolAffinityNodeAffinity) validateRequiredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution) { // not required return nil } @@ -213,6 +273,56 @@ func (m *PoolAffinityNodeAffinity) validateRequiredDuringSchedulingIgnoredDuring return nil } +// ContextValidate validate this pool affinity node affinity based on the context it is used +func (m *PoolAffinityNodeAffinity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PoolAffinityNodeAffinity) contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ { + + if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil { + if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("nodeAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PoolAffinityNodeAffinity) contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { + + if m.RequiredDuringSchedulingIgnoredDuringExecution != nil { + if err := m.RequiredDuringSchedulingIgnoredDuringExecution.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PoolAffinityNodeAffinity) MarshalBinary() ([]byte, error) { if m == nil { @@ -290,6 +400,34 @@ func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecution return nil } +// ContextValidate validate this pool affinity node affinity preferred during scheduling ignored during execution items0 based on the context it is used +func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePreference(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) contextValidatePreference(ctx context.Context, formats strfmt.Registry) error { + + if m.Preference != nil { + if err := m.Preference.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("preference") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -357,6 +495,38 @@ func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) return nil } +// ContextValidate validate this pool affinity node affinity required during scheduling ignored during execution based on the context it is used +func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNodeSelectorTerms(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) contextValidateNodeSelectorTerms(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.NodeSelectorTerms); i++ { + + if m.NodeSelectorTerms[i] != nil { + if err := m.NodeSelectorTerms[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + "nodeSelectorTerms" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution) MarshalBinary() ([]byte, error) { if m == nil { @@ -406,7 +576,6 @@ func (m *PoolAffinityPodAffinity) Validate(formats strfmt.Registry) error { } func (m *PoolAffinityPodAffinity) validatePreferredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution) { // not required return nil } @@ -431,7 +600,6 @@ func (m *PoolAffinityPodAffinity) validatePreferredDuringSchedulingIgnoredDuring } func (m *PoolAffinityPodAffinity) validateRequiredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution) { // not required return nil } @@ -455,6 +623,60 @@ func (m *PoolAffinityPodAffinity) validateRequiredDuringSchedulingIgnoredDuringE return nil } +// ContextValidate validate this pool affinity pod affinity based on the context it is used +func (m *PoolAffinityPodAffinity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PoolAffinityPodAffinity) contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ { + + if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil { + if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("podAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PoolAffinityPodAffinity) contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.RequiredDuringSchedulingIgnoredDuringExecution); i++ { + + if m.RequiredDuringSchedulingIgnoredDuringExecution[i] != nil { + if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("podAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PoolAffinityPodAffinity) MarshalBinary() ([]byte, error) { if m == nil { @@ -532,6 +754,34 @@ func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionI return nil } +// ContextValidate validate this pool affinity pod affinity preferred during scheduling ignored during execution items0 based on the context it is used +func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePodAffinityTerm(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) contextValidatePodAffinityTerm(ctx context.Context, formats strfmt.Registry) error { + + if m.PodAffinityTerm != nil { + if err := m.PodAffinityTerm.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("podAffinityTerm") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -581,7 +831,6 @@ func (m *PoolAffinityPodAntiAffinity) Validate(formats strfmt.Registry) error { } func (m *PoolAffinityPodAntiAffinity) validatePreferredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.PreferredDuringSchedulingIgnoredDuringExecution) { // not required return nil } @@ -606,7 +855,6 @@ func (m *PoolAffinityPodAntiAffinity) validatePreferredDuringSchedulingIgnoredDu } func (m *PoolAffinityPodAntiAffinity) validateRequiredDuringSchedulingIgnoredDuringExecution(formats strfmt.Registry) error { - if swag.IsZero(m.RequiredDuringSchedulingIgnoredDuringExecution) { // not required return nil } @@ -630,6 +878,60 @@ func (m *PoolAffinityPodAntiAffinity) validateRequiredDuringSchedulingIgnoredDur return nil } +// ContextValidate validate this pool affinity pod anti affinity based on the context it is used +func (m *PoolAffinityPodAntiAffinity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PoolAffinityPodAntiAffinity) contextValidatePreferredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PreferredDuringSchedulingIgnoredDuringExecution); i++ { + + if m.PreferredDuringSchedulingIgnoredDuringExecution[i] != nil { + if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("podAntiAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PoolAffinityPodAntiAffinity) contextValidateRequiredDuringSchedulingIgnoredDuringExecution(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.RequiredDuringSchedulingIgnoredDuringExecution); i++ { + + if m.RequiredDuringSchedulingIgnoredDuringExecution[i] != nil { + if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("podAntiAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PoolAffinityPodAntiAffinity) MarshalBinary() ([]byte, error) { if m == nil { @@ -707,6 +1009,34 @@ func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecut return nil } +// ContextValidate validate this pool affinity pod anti affinity preferred during scheduling ignored during execution items0 based on the context it is used +func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePodAffinityTerm(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) contextValidatePodAffinityTerm(ctx context.Context, formats strfmt.Registry) error { + + if m.PodAffinityTerm != nil { + if err := m.PodAffinityTerm.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("podAffinityTerm") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionItems0) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/pool_resources.go b/models/pool_resources.go index deefc3adf..be6421a9d 100644 --- a/models/pool_resources.go +++ b/models/pool_resources.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *PoolResources) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pool resources based on context it is used +func (m *PoolResources) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PoolResources) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/pool_toleration_seconds.go b/models/pool_toleration_seconds.go index efb693521..63a7692e3 100644 --- a/models/pool_toleration_seconds.go +++ b/models/pool_toleration_seconds.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -62,6 +64,11 @@ func (m *PoolTolerationSeconds) validateSeconds(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pool toleration seconds based on context it is used +func (m *PoolTolerationSeconds) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PoolTolerationSeconds) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/pool_tolerations.go b/models/pool_tolerations.go index b0cd327b4..2137f1c41 100644 --- a/models/pool_tolerations.go +++ b/models/pool_tolerations.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -61,6 +62,29 @@ func (m PoolTolerations) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this pool tolerations based on the context it is used +func (m PoolTolerations) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // PoolTolerationsItems0 The pod this Toleration is attached to tolerates any taint that matches the triple using the matching operator . // // swagger:model PoolTolerationsItems0 @@ -97,7 +121,6 @@ func (m *PoolTolerationsItems0) Validate(formats strfmt.Registry) error { } func (m *PoolTolerationsItems0) validateTolerationSeconds(formats strfmt.Registry) error { - if swag.IsZero(m.TolerationSeconds) { // not required return nil } @@ -114,6 +137,34 @@ func (m *PoolTolerationsItems0) validateTolerationSeconds(formats strfmt.Registr return nil } +// ContextValidate validate this pool tolerations items0 based on the context it is used +func (m *PoolTolerationsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTolerationSeconds(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PoolTolerationsItems0) contextValidateTolerationSeconds(ctx context.Context, formats strfmt.Registry) error { + + if m.TolerationSeconds != nil { + if err := m.TolerationSeconds.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tolerationSeconds") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PoolTolerationsItems0) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/pool_update_request.go b/models/pool_update_request.go index c8bdf9e8f..7a5c32978 100644 --- a/models/pool_update_request.go +++ b/models/pool_update_request.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -80,6 +81,38 @@ func (m *PoolUpdateRequest) validatePools(formats strfmt.Registry) error { return nil } +// ContextValidate validate this pool update request based on the context it is used +func (m *PoolUpdateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePools(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PoolUpdateRequest) contextValidatePools(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Pools); i++ { + + if m.Pools[i] != nil { + if err := m.Pools[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pools" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PoolUpdateRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/principal.go b/models/principal.go index 8f6d95af0..e9d655773 100644 --- a/models/principal.go +++ b/models/principal.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -53,6 +55,11 @@ func (m *Principal) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this principal based on context it is used +func (m *Principal) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Principal) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/profiler_type.go b/models/profiler_type.go index 99b1bc505..53da77e74 100644 --- a/models/profiler_type.go +++ b/models/profiler_type.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -35,6 +36,11 @@ import ( // swagger:model profilerType type ProfilerType string +func NewProfilerType(value ProfilerType) *ProfilerType { + v := value + return &v +} + const ( // ProfilerTypeCPU captures enum value "cpu" @@ -93,3 +99,8 @@ func (m ProfilerType) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this profiler type based on context it is used +func (m ProfilerType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/profiling_start_request.go b/models/profiling_start_request.go index 0d98783e7..d63b3a236 100644 --- a/models/profiling_start_request.go +++ b/models/profiling_start_request.go @@ -23,9 +23,12 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // ProfilingStartRequest profiling start request @@ -35,7 +38,7 @@ type ProfilingStartRequest struct { // type // Required: true - Type ProfilerType `json:"type"` + Type *ProfilerType `json:"type"` } // Validate validates this profiling start request @@ -54,13 +57,51 @@ func (m *ProfilingStartRequest) Validate(formats strfmt.Registry) error { func (m *ProfilingStartRequest) validateType(formats strfmt.Registry) error { - if err := m.Type.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("type") - } + if err := validate.Required("type", "body", m.Type); err != nil { return err } + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + if m.Type != nil { + if err := m.Type.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("type") + } + return err + } + } + + return nil +} + +// ContextValidate validate this profiling start request based on the context it is used +func (m *ProfilingStartRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateType(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProfilingStartRequest) contextValidateType(ctx context.Context, formats strfmt.Registry) error { + + if m.Type != nil { + if err := m.Type.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("type") + } + return err + } + } + return nil } diff --git a/models/prometheus_configuration.go b/models/prometheus_configuration.go index 458930e90..ad2c0b859 100644 --- a/models/prometheus_configuration.go +++ b/models/prometheus_configuration.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -47,6 +49,11 @@ func (m *PrometheusConfiguration) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this prometheus configuration based on context it is used +func (m *PrometheusConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PrometheusConfiguration) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/put_bucket_retention_request.go b/models/put_bucket_retention_request.go index 00e36785e..a1e3fa385 100644 --- a/models/put_bucket_retention_request.go +++ b/models/put_bucket_retention_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -36,11 +38,11 @@ type PutBucketRetentionRequest struct { // mode // Required: true - Mode ObjectRetentionMode `json:"mode"` + Mode *ObjectRetentionMode `json:"mode"` // unit // Required: true - Unit ObjectRetentionUnit `json:"unit"` + Unit *ObjectRetentionUnit `json:"unit"` // validity // Required: true @@ -71,25 +73,45 @@ func (m *PutBucketRetentionRequest) Validate(formats strfmt.Registry) error { func (m *PutBucketRetentionRequest) validateMode(formats strfmt.Registry) error { - if err := m.Mode.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("mode") - } + if err := validate.Required("mode", "body", m.Mode); err != nil { return err } + if err := validate.Required("mode", "body", m.Mode); err != nil { + return err + } + + if m.Mode != nil { + if err := m.Mode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mode") + } + return err + } + } + return nil } func (m *PutBucketRetentionRequest) validateUnit(formats strfmt.Registry) error { - if err := m.Unit.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("unit") - } + if err := validate.Required("unit", "body", m.Unit); err != nil { return err } + if err := validate.Required("unit", "body", m.Unit); err != nil { + return err + } + + if m.Unit != nil { + if err := m.Unit.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unit") + } + return err + } + } + return nil } @@ -102,6 +124,52 @@ func (m *PutBucketRetentionRequest) validateValidity(formats strfmt.Registry) er return nil } +// ContextValidate validate this put bucket retention request based on the context it is used +func (m *PutBucketRetentionRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMode(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUnit(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PutBucketRetentionRequest) contextValidateMode(ctx context.Context, formats strfmt.Registry) error { + + if m.Mode != nil { + if err := m.Mode.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mode") + } + return err + } + } + + return nil +} + +func (m *PutBucketRetentionRequest) contextValidateUnit(ctx context.Context, formats strfmt.Registry) error { + + if m.Unit != nil { + if err := m.Unit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unit") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PutBucketRetentionRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/put_object_legal_hold_request.go b/models/put_object_legal_hold_request.go index 366210849..7f4a1d126 100644 --- a/models/put_object_legal_hold_request.go +++ b/models/put_object_legal_hold_request.go @@ -23,9 +23,12 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // PutObjectLegalHoldRequest put object legal hold request @@ -35,7 +38,7 @@ type PutObjectLegalHoldRequest struct { // status // Required: true - Status ObjectLegalHoldStatus `json:"status"` + Status *ObjectLegalHoldStatus `json:"status"` } // Validate validates this put object legal hold request @@ -54,13 +57,51 @@ func (m *PutObjectLegalHoldRequest) Validate(formats strfmt.Registry) error { func (m *PutObjectLegalHoldRequest) validateStatus(formats strfmt.Registry) error { - if err := m.Status.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("status") - } + if err := validate.Required("status", "body", m.Status); err != nil { return err } + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + if m.Status != nil { + if err := m.Status.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } + return err + } + } + + return nil +} + +// ContextValidate validate this put object legal hold request based on the context it is used +func (m *PutObjectLegalHoldRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PutObjectLegalHoldRequest) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.Status != nil { + if err := m.Status.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } + return err + } + } + return nil } diff --git a/models/put_object_retention_request.go b/models/put_object_retention_request.go index 7d28ff9ac..28e0c03cd 100644 --- a/models/put_object_retention_request.go +++ b/models/put_object_retention_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -43,7 +45,7 @@ type PutObjectRetentionRequest struct { // mode // Required: true - Mode ObjectRetentionMode `json:"mode"` + Mode *ObjectRetentionMode `json:"mode"` } // Validate validates this put object retention request @@ -75,13 +77,51 @@ func (m *PutObjectRetentionRequest) validateExpires(formats strfmt.Registry) err func (m *PutObjectRetentionRequest) validateMode(formats strfmt.Registry) error { - if err := m.Mode.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("mode") - } + if err := validate.Required("mode", "body", m.Mode); err != nil { return err } + if err := validate.Required("mode", "body", m.Mode); err != nil { + return err + } + + if m.Mode != nil { + if err := m.Mode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mode") + } + return err + } + } + + return nil +} + +// ContextValidate validate this put object retention request based on the context it is used +func (m *PutObjectRetentionRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMode(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PutObjectRetentionRequest) contextValidateMode(ctx context.Context, formats strfmt.Registry) error { + + if m.Mode != nil { + if err := m.Mode.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mode") + } + return err + } + } + return nil } diff --git a/models/put_object_tags_request.go b/models/put_object_tags_request.go index ff0df725d..474570532 100644 --- a/models/put_object_tags_request.go +++ b/models/put_object_tags_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *PutObjectTagsRequest) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this put object tags request based on context it is used +func (m *PutObjectTagsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PutObjectTagsRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/pvcs_list_response.go b/models/pvcs_list_response.go index 225293f9f..10deb7f79 100644 --- a/models/pvcs_list_response.go +++ b/models/pvcs_list_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -59,6 +61,11 @@ func (m *PvcsListResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pvcs list response based on context it is used +func (m *PvcsListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PvcsListResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/remote_bucket.go b/models/remote_bucket.go index 88e2b1493..9162e7a36 100644 --- a/models/remote_bucket.go +++ b/models/remote_bucket.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -112,7 +113,7 @@ func (m *RemoteBucket) validateAccessKey(formats strfmt.Registry) error { return err } - if err := validate.MinLength("accessKey", "body", string(*m.AccessKey), 3); err != nil { + if err := validate.MinLength("accessKey", "body", *m.AccessKey, 3); err != nil { return err } @@ -129,12 +130,11 @@ func (m *RemoteBucket) validateRemoteARN(formats strfmt.Registry) error { } func (m *RemoteBucket) validateSecretKey(formats strfmt.Registry) error { - if swag.IsZero(m.SecretKey) { // not required return nil } - if err := validate.MinLength("secretKey", "body", string(m.SecretKey), 8); err != nil { + if err := validate.MinLength("secretKey", "body", m.SecretKey, 8); err != nil { return err } @@ -168,7 +168,6 @@ func (m *RemoteBucket) validateServiceEnum(path, location string, value string) } func (m *RemoteBucket) validateService(formats strfmt.Registry) error { - if swag.IsZero(m.Service) { // not required return nil } @@ -190,6 +189,11 @@ func (m *RemoteBucket) validateSourceBucket(formats strfmt.Registry) error { return nil } +// ContextValidate validates this remote bucket based on context it is used +func (m *RemoteBucket) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RemoteBucket) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/resource_quota.go b/models/resource_quota.go index 6c26b09b8..72ef13f0c 100644 --- a/models/resource_quota.go +++ b/models/resource_quota.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -57,7 +58,6 @@ func (m *ResourceQuota) Validate(formats strfmt.Registry) error { } func (m *ResourceQuota) validateElements(formats strfmt.Registry) error { - if swag.IsZero(m.Elements) { // not required return nil } @@ -81,6 +81,38 @@ func (m *ResourceQuota) validateElements(formats strfmt.Registry) error { return nil } +// ContextValidate validate this resource quota based on the context it is used +func (m *ResourceQuota) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateElements(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResourceQuota) contextValidateElements(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Elements); i++ { + + if m.Elements[i] != nil { + if err := m.Elements[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("elements" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ResourceQuota) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/resource_quota_element.go b/models/resource_quota_element.go index 0647f9507..b4305adf5 100644 --- a/models/resource_quota_element.go +++ b/models/resource_quota_element.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -47,6 +49,11 @@ func (m *ResourceQuotaElement) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this resource quota element based on context it is used +func (m *ResourceQuotaElement) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ResourceQuotaElement) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/result_target.go b/models/result_target.go index 34ad512f6..fde67a9f4 100644 --- a/models/result_target.go +++ b/models/result_target.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -60,7 +61,6 @@ func (m *ResultTarget) Validate(formats strfmt.Registry) error { } func (m *ResultTarget) validateResult(formats strfmt.Registry) error { - if swag.IsZero(m.Result) { // not required return nil } @@ -84,6 +84,38 @@ func (m *ResultTarget) validateResult(formats strfmt.Registry) error { return nil } +// ContextValidate validate this result target based on the context it is used +func (m *ResultTarget) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResultTarget) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ResultTarget) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/service_account_creds.go b/models/service_account_creds.go index 54e2f417c..43671f7d8 100644 --- a/models/service_account_creds.go +++ b/models/service_account_creds.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *ServiceAccountCreds) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this service account creds based on context it is used +func (m *ServiceAccountCreds) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ServiceAccountCreds) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/service_account_request.go b/models/service_account_request.go index 5960479a3..58182fcf2 100644 --- a/models/service_account_request.go +++ b/models/service_account_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *ServiceAccountRequest) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this service account request based on context it is used +func (m *ServiceAccountRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ServiceAccountRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/service_accounts.go b/models/service_accounts.go index 17d2f8808..d9f008e84 100644 --- a/models/service_accounts.go +++ b/models/service_accounts.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" ) @@ -35,3 +37,8 @@ type ServiceAccounts []string func (m ServiceAccounts) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this service accounts based on context it is used +func (m ServiceAccounts) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/session_response.go b/models/session_response.go index e72c252f0..ba18b44c4 100644 --- a/models/session_response.go +++ b/models/session_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -91,7 +92,6 @@ func (m *SessionResponse) validateStatusEnum(path, location string, value string } func (m *SessionResponse) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } @@ -104,6 +104,11 @@ func (m *SessionResponse) validateStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validates this session response based on context it is used +func (m *SessionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SessionResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/set_bucket_policy_request.go b/models/set_bucket_policy_request.go index 64211bae5..87ec9cb89 100644 --- a/models/set_bucket_policy_request.go +++ b/models/set_bucket_policy_request.go @@ -23,9 +23,12 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // SetBucketPolicyRequest set bucket policy request @@ -35,7 +38,7 @@ type SetBucketPolicyRequest struct { // access // Required: true - Access BucketAccess `json:"access"` + Access *BucketAccess `json:"access"` } // Validate validates this set bucket policy request @@ -54,13 +57,51 @@ func (m *SetBucketPolicyRequest) Validate(formats strfmt.Registry) error { func (m *SetBucketPolicyRequest) validateAccess(formats strfmt.Registry) error { - if err := m.Access.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("access") - } + if err := validate.Required("access", "body", m.Access); err != nil { return err } + if err := validate.Required("access", "body", m.Access); err != nil { + return err + } + + if m.Access != nil { + if err := m.Access.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("access") + } + return err + } + } + + return nil +} + +// ContextValidate validate this set bucket policy request based on the context it is used +func (m *SetBucketPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccess(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SetBucketPolicyRequest) contextValidateAccess(ctx context.Context, formats strfmt.Registry) error { + + if m.Access != nil { + if err := m.Access.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("access") + } + return err + } + } + return nil } diff --git a/models/set_bucket_quota.go b/models/set_bucket_quota.go index f0657a665..bdf766d27 100644 --- a/models/set_bucket_quota.go +++ b/models/set_bucket_quota.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -105,7 +106,6 @@ func (m *SetBucketQuota) validateQuotaTypeEnum(path, location string, value stri } func (m *SetBucketQuota) validateQuotaType(formats strfmt.Registry) error { - if swag.IsZero(m.QuotaType) { // not required return nil } @@ -118,6 +118,11 @@ func (m *SetBucketQuota) validateQuotaType(formats strfmt.Registry) error { return nil } +// ContextValidate validates this set bucket quota based on context it is used +func (m *SetBucketQuota) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SetBucketQuota) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/set_bucket_versioning.go b/models/set_bucket_versioning.go index 694c05edc..299fe8677 100644 --- a/models/set_bucket_versioning.go +++ b/models/set_bucket_versioning.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *SetBucketVersioning) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this set bucket versioning based on context it is used +func (m *SetBucketVersioning) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SetBucketVersioning) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/set_config_request.go b/models/set_config_request.go index bc43c7740..3ff7a3f07 100644 --- a/models/set_config_request.go +++ b/models/set_config_request.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -90,6 +91,38 @@ func (m *SetConfigRequest) validateKeyValues(formats strfmt.Registry) error { return nil } +// ContextValidate validate this set config request based on the context it is used +func (m *SetConfigRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKeyValues(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SetConfigRequest) contextValidateKeyValues(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.KeyValues); i++ { + + if m.KeyValues[i] != nil { + if err := m.KeyValues[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("key_values" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *SetConfigRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/set_config_response.go b/models/set_config_response.go index fcfe0ab0c..63b7da866 100644 --- a/models/set_config_response.go +++ b/models/set_config_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *SetConfigResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this set config response based on context it is used +func (m *SetConfigResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SetConfigResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/set_notification_endpoint_response.go b/models/set_notification_endpoint_response.go index e7807f714..78b1e2dc9 100644 --- a/models/set_notification_endpoint_response.go +++ b/models/set_notification_endpoint_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -47,7 +49,7 @@ type SetNotificationEndpointResponse struct { // service // Required: true - Service NofiticationService `json:"service"` + Service *NofiticationService `json:"service"` } // Validate validates this set notification endpoint response @@ -83,18 +85,60 @@ func (m *SetNotificationEndpointResponse) validateAccountID(formats strfmt.Regis func (m *SetNotificationEndpointResponse) validateProperties(formats strfmt.Registry) error { + if err := validate.Required("properties", "body", m.Properties); err != nil { + return err + } + return nil } func (m *SetNotificationEndpointResponse) validateService(formats strfmt.Registry) error { - if err := m.Service.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("service") - } + if err := validate.Required("service", "body", m.Service); err != nil { return err } + if err := validate.Required("service", "body", m.Service); err != nil { + return err + } + + if m.Service != nil { + if err := m.Service.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service") + } + return err + } + } + + return nil +} + +// ContextValidate validate this set notification endpoint response based on the context it is used +func (m *SetNotificationEndpointResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateService(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SetNotificationEndpointResponse) contextValidateService(ctx context.Context, formats strfmt.Registry) error { + + if m.Service != nil { + if err := m.Service.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service") + } + return err + } + } + return nil } diff --git a/models/set_policy_multiple_request.go b/models/set_policy_multiple_request.go index b3cd5b3ac..4c90c6100 100644 --- a/models/set_policy_multiple_request.go +++ b/models/set_policy_multiple_request.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -61,7 +62,6 @@ func (m *SetPolicyMultipleRequest) Validate(formats strfmt.Registry) error { } func (m *SetPolicyMultipleRequest) validateGroups(formats strfmt.Registry) error { - if swag.IsZero(m.Groups) { // not required return nil } @@ -81,7 +81,6 @@ func (m *SetPolicyMultipleRequest) validateGroups(formats strfmt.Registry) error } func (m *SetPolicyMultipleRequest) validateUsers(formats strfmt.Registry) error { - if swag.IsZero(m.Users) { // not required return nil } @@ -100,6 +99,56 @@ func (m *SetPolicyMultipleRequest) validateUsers(formats strfmt.Registry) error return nil } +// ContextValidate validate this set policy multiple request based on the context it is used +func (m *SetPolicyMultipleRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGroups(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SetPolicyMultipleRequest) contextValidateGroups(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Groups); i++ { + + if err := m.Groups[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("groups" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +func (m *SetPolicyMultipleRequest) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Users); i++ { + + if err := m.Users[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *SetPolicyMultipleRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/set_policy_request.go b/models/set_policy_request.go index 121adc6b2..e82d9fe0a 100644 --- a/models/set_policy_request.go +++ b/models/set_policy_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -40,7 +42,7 @@ type SetPolicyRequest struct { // entity type // Required: true - EntityType PolicyEntity `json:"entityType"` + EntityType *PolicyEntity `json:"entityType"` } // Validate validates this set policy request @@ -72,13 +74,51 @@ func (m *SetPolicyRequest) validateEntityName(formats strfmt.Registry) error { func (m *SetPolicyRequest) validateEntityType(formats strfmt.Registry) error { - if err := m.EntityType.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("entityType") - } + if err := validate.Required("entityType", "body", m.EntityType); err != nil { return err } + if err := validate.Required("entityType", "body", m.EntityType); err != nil { + return err + } + + if m.EntityType != nil { + if err := m.EntityType.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("entityType") + } + return err + } + } + + return nil +} + +// ContextValidate validate this set policy request based on the context it is used +func (m *SetPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEntityType(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SetPolicyRequest) contextValidateEntityType(ctx context.Context, formats strfmt.Registry) error { + + if m.EntityType != nil { + if err := m.EntityType.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("entityType") + } + return err + } + } + return nil } diff --git a/models/start_profiling_item.go b/models/start_profiling_item.go index 3a6fe9586..6532ec553 100644 --- a/models/start_profiling_item.go +++ b/models/start_profiling_item.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -47,6 +49,11 @@ func (m *StartProfilingItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this start profiling item based on context it is used +func (m *StartProfilingItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *StartProfilingItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/start_profiling_list.go b/models/start_profiling_list.go index dabe1d15d..99605b6cc 100644 --- a/models/start_profiling_list.go +++ b/models/start_profiling_list.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -57,7 +58,6 @@ func (m *StartProfilingList) Validate(formats strfmt.Registry) error { } func (m *StartProfilingList) validateStartResults(formats strfmt.Registry) error { - if swag.IsZero(m.StartResults) { // not required return nil } @@ -81,6 +81,38 @@ func (m *StartProfilingList) validateStartResults(formats strfmt.Registry) error return nil } +// ContextValidate validate this start profiling list based on the context it is used +func (m *StartProfilingList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateStartResults(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StartProfilingList) contextValidateStartResults(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.StartResults); i++ { + + if m.StartResults[i] != nil { + if err := m.StartResults[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("startResults" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *StartProfilingList) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/subscription_validate_request.go b/models/subscription_validate_request.go index c42e03464..ba075f65c 100644 --- a/models/subscription_validate_request.go +++ b/models/subscription_validate_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -47,6 +49,11 @@ func (m *SubscriptionValidateRequest) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this subscription validate request based on context it is used +func (m *SubscriptionValidateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SubscriptionValidateRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tenant.go b/models/tenant.go index 5699c093e..d509eb69e 100644 --- a/models/tenant.go +++ b/models/tenant.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -117,7 +118,6 @@ func (m *Tenant) Validate(formats strfmt.Registry) error { } func (m *Tenant) validateEndpoints(formats strfmt.Registry) error { - if swag.IsZero(m.Endpoints) { // not required return nil } @@ -135,7 +135,6 @@ func (m *Tenant) validateEndpoints(formats strfmt.Registry) error { } func (m *Tenant) validatePools(formats strfmt.Registry) error { - if swag.IsZero(m.Pools) { // not required return nil } @@ -160,7 +159,6 @@ func (m *Tenant) validatePools(formats strfmt.Registry) error { } func (m *Tenant) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } @@ -178,7 +176,6 @@ func (m *Tenant) validateStatus(formats strfmt.Registry) error { } func (m *Tenant) validateSubnetLicense(formats strfmt.Registry) error { - if swag.IsZero(m.SubnetLicense) { // not required return nil } @@ -195,6 +192,92 @@ func (m *Tenant) validateSubnetLicense(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tenant based on the context it is used +func (m *Tenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEndpoints(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePools(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSubnetLicense(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Tenant) contextValidateEndpoints(ctx context.Context, formats strfmt.Registry) error { + + if m.Endpoints != nil { + if err := m.Endpoints.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("endpoints") + } + return err + } + } + + return nil +} + +func (m *Tenant) contextValidatePools(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Pools); i++ { + + if m.Pools[i] != nil { + if err := m.Pools[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pools" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.Status != nil { + if err := m.Status.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } + return err + } + } + + return nil +} + +func (m *Tenant) contextValidateSubnetLicense(ctx context.Context, formats strfmt.Registry) error { + + if m.SubnetLicense != nil { + if err := m.SubnetLicense.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("subnet_license") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Tenant) MarshalBinary() ([]byte, error) { if m == nil { @@ -230,6 +313,11 @@ func (m *TenantEndpoints) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tenant endpoints based on context it is used +func (m *TenantEndpoints) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TenantEndpoints) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tenant_list.go b/models/tenant_list.go index 10c6a3bc3..95bab5609 100644 --- a/models/tenant_list.go +++ b/models/tenant_list.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -68,6 +70,11 @@ func (m *TenantList) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tenant list based on context it is used +func (m *TenantList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TenantList) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tenant_pod.go b/models/tenant_pod.go index b2c9e6296..cfaaff35f 100644 --- a/models/tenant_pod.go +++ b/models/tenant_pod.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -77,6 +79,11 @@ func (m *TenantPod) validateName(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tenant pod based on context it is used +func (m *TenantPod) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TenantPod) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tenant_response_item.go b/models/tenant_response_item.go index a0f1a9b27..67dacee48 100644 --- a/models/tenant_response_item.go +++ b/models/tenant_response_item.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *TenantResponseItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tenant response item based on context it is used +func (m *TenantResponseItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TenantResponseItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tenant_status.go b/models/tenant_status.go index 2349a63cc..03319a69e 100644 --- a/models/tenant_status.go +++ b/models/tenant_status.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -53,6 +55,11 @@ func (m *TenantStatus) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tenant status based on context it is used +func (m *TenantStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TenantStatus) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tenant_usage.go b/models/tenant_usage.go index 989641bae..d82d1eed1 100644 --- a/models/tenant_usage.go +++ b/models/tenant_usage.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *TenantUsage) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tenant usage based on context it is used +func (m *TenantUsage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TenantUsage) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tenant_y_a_m_l.go b/models/tenant_y_a_m_l.go index 20bf79217..97dadc1cc 100644 --- a/models/tenant_y_a_m_l.go +++ b/models/tenant_y_a_m_l.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -41,6 +43,11 @@ func (m *TenantYAML) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tenant y a m l based on context it is used +func (m *TenantYAML) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TenantYAML) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tier.go b/models/tier.go index a92e15ce8..373084591 100644 --- a/models/tier.go +++ b/models/tier.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -77,7 +78,6 @@ func (m *Tier) Validate(formats strfmt.Registry) error { } func (m *Tier) validateAzure(formats strfmt.Registry) error { - if swag.IsZero(m.Azure) { // not required return nil } @@ -95,7 +95,6 @@ func (m *Tier) validateAzure(formats strfmt.Registry) error { } func (m *Tier) validateGcs(formats strfmt.Registry) error { - if swag.IsZero(m.Gcs) { // not required return nil } @@ -113,7 +112,6 @@ func (m *Tier) validateGcs(formats strfmt.Registry) error { } func (m *Tier) validateS3(formats strfmt.Registry) error { - if swag.IsZero(m.S3) { // not required return nil } @@ -166,7 +164,6 @@ func (m *Tier) validateTypeEnum(path, location string, value string) error { } func (m *Tier) validateType(formats strfmt.Registry) error { - if swag.IsZero(m.Type) { // not required return nil } @@ -179,6 +176,70 @@ func (m *Tier) validateType(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tier based on the context it is used +func (m *Tier) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAzure(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGcs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateS3(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Tier) contextValidateAzure(ctx context.Context, formats strfmt.Registry) error { + + if m.Azure != nil { + if err := m.Azure.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("azure") + } + return err + } + } + + return nil +} + +func (m *Tier) contextValidateGcs(ctx context.Context, formats strfmt.Registry) error { + + if m.Gcs != nil { + if err := m.Gcs.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gcs") + } + return err + } + } + + return nil +} + +func (m *Tier) contextValidateS3(ctx context.Context, formats strfmt.Registry) error { + + if m.S3 != nil { + if err := m.S3.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("s3") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Tier) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tier_azure.go b/models/tier_azure.go index 1e9b50fcc..684aa7118 100644 --- a/models/tier_azure.go +++ b/models/tier_azure.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -59,6 +61,11 @@ func (m *TierAzure) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tier azure based on context it is used +func (m *TierAzure) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TierAzure) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tier_credentials_request.go b/models/tier_credentials_request.go index 9353601ae..849d1d69e 100644 --- a/models/tier_credentials_request.go +++ b/models/tier_credentials_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -47,6 +49,11 @@ func (m *TierCredentialsRequest) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tier credentials request based on context it is used +func (m *TierCredentialsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TierCredentialsRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tier_gcs.go b/models/tier_gcs.go index e6d6a9970..38778467f 100644 --- a/models/tier_gcs.go +++ b/models/tier_gcs.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -56,6 +58,11 @@ func (m *TierGcs) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tier gcs based on context it is used +func (m *TierGcs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TierGcs) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tier_list_response.go b/models/tier_list_response.go index 7ffbca278..552101bb7 100644 --- a/models/tier_list_response.go +++ b/models/tier_list_response.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -54,7 +55,6 @@ func (m *TierListResponse) Validate(formats strfmt.Registry) error { } func (m *TierListResponse) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -78,6 +78,38 @@ func (m *TierListResponse) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tier list response based on the context it is used +func (m *TierListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TierListResponse) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *TierListResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tier_s3.go b/models/tier_s3.go index f69c4105b..7f7aca349 100644 --- a/models/tier_s3.go +++ b/models/tier_s3.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -62,6 +64,11 @@ func (m *TierS3) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tier s3 based on context it is used +func (m *TierS3) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TierS3) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/tls_configuration.go b/models/tls_configuration.go index 8f6dd6461..c0aa0fe0f 100644 --- a/models/tls_configuration.go +++ b/models/tls_configuration.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -64,7 +65,6 @@ func (m *TLSConfiguration) Validate(formats strfmt.Registry) error { } func (m *TLSConfiguration) validateConsole(formats strfmt.Registry) error { - if swag.IsZero(m.Console) { // not required return nil } @@ -82,7 +82,6 @@ func (m *TLSConfiguration) validateConsole(formats strfmt.Registry) error { } func (m *TLSConfiguration) validateMinio(formats strfmt.Registry) error { - if swag.IsZero(m.Minio) { // not required return nil } @@ -106,6 +105,56 @@ func (m *TLSConfiguration) validateMinio(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tls configuration based on the context it is used +func (m *TLSConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateConsole(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMinio(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TLSConfiguration) contextValidateConsole(ctx context.Context, formats strfmt.Registry) error { + + if m.Console != nil { + if err := m.Console.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("console") + } + return err + } + } + + return nil +} + +func (m *TLSConfiguration) contextValidateMinio(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Minio); i++ { + + if m.Minio[i] != nil { + if err := m.Minio[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("minio" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *TLSConfiguration) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/transition_response.go b/models/transition_response.go index a8bbe2683..19ac6997d 100644 --- a/models/transition_response.go +++ b/models/transition_response.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -47,6 +49,11 @@ func (m *TransitionResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this transition response based on context it is used +func (m *TransitionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransitionResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/update_bucket_lifecycle.go b/models/update_bucket_lifecycle.go index 6f01e82fd..b21150281 100644 --- a/models/update_bucket_lifecycle.go +++ b/models/update_bucket_lifecycle.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *UpdateBucketLifecycle) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this update bucket lifecycle based on context it is used +func (m *UpdateBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UpdateBucketLifecycle) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/update_group_request.go b/models/update_group_request.go index 7989360f0..de6436dca 100644 --- a/models/update_group_request.go +++ b/models/update_group_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -79,6 +81,11 @@ func (m *UpdateGroupRequest) validateStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validates this update group request based on context it is used +func (m *UpdateGroupRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UpdateGroupRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/update_tenant_request.go b/models/update_tenant_request.go index 2e2697d7a..167eaea59 100644 --- a/models/update_tenant_request.go +++ b/models/update_tenant_request.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -75,12 +77,11 @@ func (m *UpdateTenantRequest) Validate(formats strfmt.Registry) error { } func (m *UpdateTenantRequest) validateConsoleImage(formats strfmt.Registry) error { - if swag.IsZero(m.ConsoleImage) { // not required return nil } - if err := validate.Pattern("console_image", "body", string(m.ConsoleImage), `^((.*?)/(.*?):(.+))$`); err != nil { + if err := validate.Pattern("console_image", "body", m.ConsoleImage, `^((.*?)/(.*?):(.+))$`); err != nil { return err } @@ -88,12 +89,11 @@ func (m *UpdateTenantRequest) validateConsoleImage(formats strfmt.Registry) erro } func (m *UpdateTenantRequest) validateImage(formats strfmt.Registry) error { - if swag.IsZero(m.Image) { // not required return nil } - if err := validate.Pattern("image", "body", string(m.Image), `^((.*?)/(.*?):(.+))$`); err != nil { + if err := validate.Pattern("image", "body", m.Image, `^((.*?)/(.*?):(.+))$`); err != nil { return err } @@ -101,7 +101,6 @@ func (m *UpdateTenantRequest) validateImage(formats strfmt.Registry) error { } func (m *UpdateTenantRequest) validateImageRegistry(formats strfmt.Registry) error { - if swag.IsZero(m.ImageRegistry) { // not required return nil } @@ -118,6 +117,34 @@ func (m *UpdateTenantRequest) validateImageRegistry(formats strfmt.Registry) err return nil } +// ContextValidate validate this update tenant request based on the context it is used +func (m *UpdateTenantRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateImageRegistry(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateTenantRequest) contextValidateImageRegistry(ctx context.Context, formats strfmt.Registry) error { + + if m.ImageRegistry != nil { + if err := m.ImageRegistry.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("image_registry") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *UpdateTenantRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/update_user.go b/models/update_user.go index c13321ef8..6ab8d84c8 100644 --- a/models/update_user.go +++ b/models/update_user.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -79,6 +81,11 @@ func (m *UpdateUser) validateStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validates this update user based on context it is used +func (m *UpdateUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UpdateUser) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/update_user_groups.go b/models/update_user_groups.go index 021140337..51a1b5bdc 100644 --- a/models/update_user_groups.go +++ b/models/update_user_groups.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -62,6 +64,11 @@ func (m *UpdateUserGroups) validateGroups(formats strfmt.Registry) error { return nil } +// ContextValidate validates this update user groups based on context it is used +func (m *UpdateUserGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UpdateUserGroups) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/user.go b/models/user.go index 8101c22ea..53e3270be 100644 --- a/models/user.go +++ b/models/user.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -50,6 +52,11 @@ func (m *User) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this user based on context it is used +func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *User) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/vault_configuration.go b/models/vault_configuration.go index 79baf8c93..4d7d3dbb6 100644 --- a/models/vault_configuration.go +++ b/models/vault_configuration.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" @@ -112,7 +114,6 @@ func (m *VaultConfiguration) validateEndpoint(formats strfmt.Registry) error { } func (m *VaultConfiguration) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } @@ -130,7 +131,6 @@ func (m *VaultConfiguration) validateStatus(formats strfmt.Registry) error { } func (m *VaultConfiguration) validateTLS(formats strfmt.Registry) error { - if swag.IsZero(m.TLS) { // not required return nil } @@ -147,6 +147,70 @@ func (m *VaultConfiguration) validateTLS(formats strfmt.Registry) error { return nil } +// ContextValidate validate this vault configuration based on the context it is used +func (m *VaultConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateApprole(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTLS(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VaultConfiguration) contextValidateApprole(ctx context.Context, formats strfmt.Registry) error { + + if m.Approle != nil { + if err := m.Approle.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("approle") + } + return err + } + } + + return nil +} + +func (m *VaultConfiguration) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.Status != nil { + if err := m.Status.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } + return err + } + } + + return nil +} + +func (m *VaultConfiguration) contextValidateTLS(ctx context.Context, formats strfmt.Registry) error { + + if m.TLS != nil { + if err := m.TLS.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tls") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *VaultConfiguration) MarshalBinary() ([]byte, error) { if m == nil { @@ -221,6 +285,11 @@ func (m *VaultConfigurationApprole) validateSecret(formats strfmt.Registry) erro return nil } +// ContextValidate validates this vault configuration approle based on context it is used +func (m *VaultConfigurationApprole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VaultConfigurationApprole) MarshalBinary() ([]byte, error) { if m == nil { @@ -253,6 +322,11 @@ func (m *VaultConfigurationStatus) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this vault configuration status based on context it is used +func (m *VaultConfigurationStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VaultConfigurationStatus) MarshalBinary() ([]byte, error) { if m == nil { @@ -291,6 +365,11 @@ func (m *VaultConfigurationTLS) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this vault configuration TLS based on context it is used +func (m *VaultConfigurationTLS) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VaultConfigurationTLS) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/widget.go b/models/widget.go index 86290656f..a1fb2c568 100644 --- a/models/widget.go +++ b/models/widget.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -70,7 +71,6 @@ func (m *Widget) Validate(formats strfmt.Registry) error { } func (m *Widget) validateOptions(formats strfmt.Registry) error { - if swag.IsZero(m.Options) { // not required return nil } @@ -88,7 +88,6 @@ func (m *Widget) validateOptions(formats strfmt.Registry) error { } func (m *Widget) validateTargets(formats strfmt.Registry) error { - if swag.IsZero(m.Targets) { // not required return nil } @@ -112,6 +111,56 @@ func (m *Widget) validateTargets(formats strfmt.Registry) error { return nil } +// ContextValidate validate this widget based on the context it is used +func (m *Widget) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTargets(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Widget) contextValidateOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.Options != nil { + if err := m.Options.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options") + } + return err + } + } + + return nil +} + +func (m *Widget) contextValidateTargets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Targets); i++ { + + if m.Targets[i] != nil { + if err := m.Targets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("targets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Widget) MarshalBinary() ([]byte, error) { if m == nil { @@ -154,7 +203,6 @@ func (m *WidgetOptions) Validate(formats strfmt.Registry) error { } func (m *WidgetOptions) validateReduceOptions(formats strfmt.Registry) error { - if swag.IsZero(m.ReduceOptions) { // not required return nil } @@ -171,6 +219,34 @@ func (m *WidgetOptions) validateReduceOptions(formats strfmt.Registry) error { return nil } +// ContextValidate validate this widget options based on the context it is used +func (m *WidgetOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateReduceOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *WidgetOptions) contextValidateReduceOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.ReduceOptions != nil { + if err := m.ReduceOptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options" + "." + "reduceOptions") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *WidgetOptions) MarshalBinary() ([]byte, error) { if m == nil { @@ -203,6 +279,11 @@ func (m *WidgetOptionsReduceOptions) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this widget options reduce options based on context it is used +func (m *WidgetOptionsReduceOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *WidgetOptionsReduceOptions) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/widget_details.go b/models/widget_details.go index 3f09dbe80..de10b47c7 100644 --- a/models/widget_details.go +++ b/models/widget_details.go @@ -23,6 +23,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -70,7 +71,6 @@ func (m *WidgetDetails) Validate(formats strfmt.Registry) error { } func (m *WidgetDetails) validateOptions(formats strfmt.Registry) error { - if swag.IsZero(m.Options) { // not required return nil } @@ -88,7 +88,6 @@ func (m *WidgetDetails) validateOptions(formats strfmt.Registry) error { } func (m *WidgetDetails) validateTargets(formats strfmt.Registry) error { - if swag.IsZero(m.Targets) { // not required return nil } @@ -112,6 +111,56 @@ func (m *WidgetDetails) validateTargets(formats strfmt.Registry) error { return nil } +// ContextValidate validate this widget details based on the context it is used +func (m *WidgetDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTargets(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *WidgetDetails) contextValidateOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.Options != nil { + if err := m.Options.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options") + } + return err + } + } + + return nil +} + +func (m *WidgetDetails) contextValidateTargets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Targets); i++ { + + if m.Targets[i] != nil { + if err := m.Targets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("targets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *WidgetDetails) MarshalBinary() ([]byte, error) { if m == nil { @@ -154,7 +203,6 @@ func (m *WidgetDetailsOptions) Validate(formats strfmt.Registry) error { } func (m *WidgetDetailsOptions) validateReduceOptions(formats strfmt.Registry) error { - if swag.IsZero(m.ReduceOptions) { // not required return nil } @@ -171,6 +219,34 @@ func (m *WidgetDetailsOptions) validateReduceOptions(formats strfmt.Registry) er return nil } +// ContextValidate validate this widget details options based on the context it is used +func (m *WidgetDetailsOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateReduceOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *WidgetDetailsOptions) contextValidateReduceOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.ReduceOptions != nil { + if err := m.ReduceOptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options" + "." + "reduceOptions") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *WidgetDetailsOptions) MarshalBinary() ([]byte, error) { if m == nil { @@ -203,6 +279,11 @@ func (m *WidgetDetailsOptionsReduceOptions) Validate(formats strfmt.Registry) er return nil } +// ContextValidate validates this widget details options reduce options based on context it is used +func (m *WidgetDetailsOptionsReduceOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *WidgetDetailsOptionsReduceOptions) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/widget_result.go b/models/widget_result.go index a68d88bb3..420f67449 100644 --- a/models/widget_result.go +++ b/models/widget_result.go @@ -23,6 +23,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -44,6 +46,11 @@ func (m *WidgetResult) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this widget result based on context it is used +func (m *WidgetResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *WidgetResult) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/restapi/admin_notification_endpoints.go b/restapi/admin_notification_endpoints.go index b5e27fe4c..6b6022707 100644 --- a/restapi/admin_notification_endpoints.go +++ b/restapi/admin_notification_endpoints.go @@ -100,7 +100,7 @@ func addNotificationEndpoint(ctx context.Context, client MinioAdmin, params *adm var configName string // we have different add validations for each service - switch params.Body.Service { + switch *params.Body.Service { case models.NofiticationServiceAmqp: configName = "notify_amqp" case models.NofiticationServiceMqtt: diff --git a/restapi/admin_notification_endpoints_test.go b/restapi/admin_notification_endpoints_test.go index 096e27aa5..e209d28af 100644 --- a/restapi/admin_notification_endpoints_test.go +++ b/restapi/admin_notification_endpoints_test.go @@ -57,7 +57,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "user": "user", "password": "passwrd", }, - Service: "postgres", + Service: models.NewNofiticationService("postgres"), }, }, }, @@ -71,7 +71,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "user": "user", "password": "passwrd", }, - Service: "postgres", + Service: models.NewNofiticationService("postgres"), Restart: false, }, wantErr: false, @@ -90,7 +90,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "user": "user", "password": "passwrd", }, - Service: "postgres", + Service: models.NewNofiticationService("postgres"), }, }, }, @@ -114,7 +114,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "user": "user", "password": "passwrd", }, - Service: "mysql", + Service: models.NewNofiticationService("mysql"), }, }, }, @@ -128,7 +128,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "user": "user", "password": "passwrd", }, - Service: "mysql", + Service: models.NewNofiticationService("mysql"), Restart: false, }, wantErr: false, @@ -145,7 +145,7 @@ func Test_addNotificationEndpoint(t *testing.T) { Properties: map[string]string{ "brokers": "http://localhost:8080/broker1", }, - Service: "kafka", + Service: models.NewNofiticationService("kafka"), }, }, }, @@ -157,7 +157,7 @@ func Test_addNotificationEndpoint(t *testing.T) { Properties: map[string]string{ "brokers": "http://localhost:8080/broker1", }, - Service: "kafka", + Service: models.NewNofiticationService("kafka"), Restart: false, }, wantErr: false, @@ -174,7 +174,7 @@ func Test_addNotificationEndpoint(t *testing.T) { Properties: map[string]string{ "url": "http://localhost:8080/broker1", }, - Service: "amqp", + Service: models.NewNofiticationService("amqp"), }, }, }, @@ -186,7 +186,7 @@ func Test_addNotificationEndpoint(t *testing.T) { Properties: map[string]string{ "url": "http://localhost:8080/broker1", }, - Service: "amqp", + Service: models.NewNofiticationService("amqp"), Restart: false, }, wantErr: false, @@ -204,7 +204,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "broker": "http://localhost:8080/broker1", "topic": "minio", }, - Service: "mqtt", + Service: models.NewNofiticationService("mqtt"), }, }, }, @@ -217,7 +217,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "broker": "http://localhost:8080/broker1", "topic": "minio", }, - Service: "mqtt", + Service: models.NewNofiticationService("mqtt"), Restart: false, }, wantErr: false, @@ -236,7 +236,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "index": "minio", "format": "namespace", }, - Service: "elasticsearch", + Service: models.NewNofiticationService("elasticsearch"), }, }, }, @@ -250,7 +250,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "index": "minio", "format": "namespace", }, - Service: "elasticsearch", + Service: models.NewNofiticationService("elasticsearch"), Restart: false, }, wantErr: false, @@ -269,7 +269,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "key": "minio", "format": "namespace", }, - Service: "redis", + Service: models.NewNofiticationService("redis"), }, }, }, @@ -283,7 +283,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "key": "minio", "format": "namespace", }, - Service: "redis", + Service: models.NewNofiticationService("redis"), Restart: false, }, wantErr: false, @@ -301,7 +301,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "address": "http://localhost:8080/broker1", "subject": "minio", }, - Service: "nats", + Service: models.NewNofiticationService("nats"), }, }, }, @@ -314,7 +314,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "address": "http://localhost:8080/broker1", "subject": "minio", }, - Service: "nats", + Service: models.NewNofiticationService("nats"), Restart: false, }, wantErr: false, @@ -331,7 +331,7 @@ func Test_addNotificationEndpoint(t *testing.T) { Properties: map[string]string{ "endpoint": "http://localhost:8080/broker1", }, - Service: "webhook", + Service: models.NewNofiticationService("webhook"), }, }, }, @@ -343,7 +343,7 @@ func Test_addNotificationEndpoint(t *testing.T) { Properties: map[string]string{ "endpoint": "http://localhost:8080/broker1", }, - Service: "webhook", + Service: models.NewNofiticationService("webhook"), Restart: false, }, wantErr: false, @@ -361,7 +361,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "nsqd_address": "http://localhost:8080/broker1", "topic": "minio", }, - Service: "nsq", + Service: models.NewNofiticationService("nsq"), }, }, }, @@ -374,7 +374,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "nsqd_address": "http://localhost:8080/broker1", "topic": "minio", }, - Service: "nsq", + Service: models.NewNofiticationService("nsq"), Restart: false, }, wantErr: false, @@ -393,7 +393,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "user": "user", "password": "passwrd", }, - Service: "oorgle", + Service: models.NewNofiticationService("oorgle"), }, }, }, @@ -417,7 +417,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "user": "user", "password": "passwrd", }, - Service: "postgres", + Service: models.NewNofiticationService("postgres"), }, }, }, @@ -431,7 +431,7 @@ func Test_addNotificationEndpoint(t *testing.T) { "user": "user", "password": "passwrd", }, - Service: "postgres", + Service: models.NewNofiticationService("postgres"), Restart: true, }, wantErr: false, diff --git a/restapi/admin_policies.go b/restapi/admin_policies.go index 3a2f36b74..bf760a58c 100644 --- a/restapi/admin_policies.go +++ b/restapi/admin_policies.go @@ -345,7 +345,7 @@ func getSetPolicyResponse(session *models.Principal, name string, params *models // defining the client to be used adminClient := adminClient{client: mAdmin} - if err := setPolicy(ctx, adminClient, name, *params.EntityName, params.EntityType); err != nil { + if err := setPolicy(ctx, adminClient, name, *params.EntityName, *params.EntityType); err != nil { return prepareError(err) } return nil diff --git a/restapi/admin_profiling.go b/restapi/admin_profiling.go index 09b79bd0a..192b65ac6 100644 --- a/restapi/admin_profiling.go +++ b/restapi/admin_profiling.go @@ -95,7 +95,7 @@ func getProfilingStartResponse(session *models.Principal, params *models.Profili // create a MinIO Admin Client interface implementation // defining the client to be used adminClient := adminClient{client: mAdmin} - profilingItems, err := startProfiling(ctx, adminClient, params.Type) + profilingItems, err := startProfiling(ctx, adminClient, *params.Type) if err != nil { return nil, prepareError(err) } diff --git a/restapi/operations/admin_api/add_group.go b/restapi/operations/admin_api/add_group.go index 609193708..6e929ea14 100644 --- a/restapi/operations/admin_api/add_group.go +++ b/restapi/operations/admin_api/add_group.go @@ -48,7 +48,7 @@ func NewAddGroup(ctx *middleware.Context, handler AddGroupHandler) *AddGroup { return &AddGroup{Context: ctx, Handler: handler} } -/*AddGroup swagger:route POST /groups AdminAPI addGroup +/* AddGroup swagger:route POST /groups AdminAPI addGroup Add Group @@ -61,17 +61,16 @@ type AddGroup struct { func (o *AddGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewAddGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *AddGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/add_group_parameters.go b/restapi/operations/admin_api/add_group_parameters.go index 0cb537677..cad8a8793 100644 --- a/restapi/operations/admin_api/add_group_parameters.go +++ b/restapi/operations/admin_api/add_group_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewAddGroupParams creates a new AddGroupParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewAddGroupParams() AddGroupParams { return AddGroupParams{} @@ -80,6 +83,11 @@ func (o *AddGroupParams) BindRequest(r *http.Request, route *middleware.MatchedR res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/admin_api/add_notification_endpoint.go b/restapi/operations/admin_api/add_notification_endpoint.go index 5111e8828..4d674a003 100644 --- a/restapi/operations/admin_api/add_notification_endpoint.go +++ b/restapi/operations/admin_api/add_notification_endpoint.go @@ -48,7 +48,7 @@ func NewAddNotificationEndpoint(ctx *middleware.Context, handler AddNotification return &AddNotificationEndpoint{Context: ctx, Handler: handler} } -/*AddNotificationEndpoint swagger:route POST /admin/notification_endpoints AdminAPI addNotificationEndpoint +/* AddNotificationEndpoint swagger:route POST /admin/notification_endpoints AdminAPI addNotificationEndpoint Allows to configure a new notification endpoint @@ -61,17 +61,16 @@ type AddNotificationEndpoint struct { func (o *AddNotificationEndpoint) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewAddNotificationEndpointParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *AddNotificationEndpoint) ServeHTTP(rw http.ResponseWriter, r *http.Requ } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/add_notification_endpoint_parameters.go b/restapi/operations/admin_api/add_notification_endpoint_parameters.go index f75bd1579..bd5cf4f49 100644 --- a/restapi/operations/admin_api/add_notification_endpoint_parameters.go +++ b/restapi/operations/admin_api/add_notification_endpoint_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewAddNotificationEndpointParams creates a new AddNotificationEndpointParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewAddNotificationEndpointParams() AddNotificationEndpointParams { return AddNotificationEndpointParams{} @@ -80,6 +83,11 @@ func (o *AddNotificationEndpointParams) BindRequest(r *http.Request, route *midd res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/admin_api/add_policy.go b/restapi/operations/admin_api/add_policy.go index 7f92927d2..83e8cdb4a 100644 --- a/restapi/operations/admin_api/add_policy.go +++ b/restapi/operations/admin_api/add_policy.go @@ -48,7 +48,7 @@ func NewAddPolicy(ctx *middleware.Context, handler AddPolicyHandler) *AddPolicy return &AddPolicy{Context: ctx, Handler: handler} } -/*AddPolicy swagger:route POST /policies AdminAPI addPolicy +/* AddPolicy swagger:route POST /policies AdminAPI addPolicy Add Policy @@ -61,17 +61,16 @@ type AddPolicy struct { func (o *AddPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewAddPolicyParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *AddPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/add_policy_parameters.go b/restapi/operations/admin_api/add_policy_parameters.go index 0f575418f..a0b7b765e 100644 --- a/restapi/operations/admin_api/add_policy_parameters.go +++ b/restapi/operations/admin_api/add_policy_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewAddPolicyParams creates a new AddPolicyParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewAddPolicyParams() AddPolicyParams { return AddPolicyParams{} @@ -80,6 +83,11 @@ func (o *AddPolicyParams) BindRequest(r *http.Request, route *middleware.Matched res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/admin_api/add_tier.go b/restapi/operations/admin_api/add_tier.go index 85a2845ab..31912265d 100644 --- a/restapi/operations/admin_api/add_tier.go +++ b/restapi/operations/admin_api/add_tier.go @@ -48,7 +48,7 @@ func NewAddTier(ctx *middleware.Context, handler AddTierHandler) *AddTier { return &AddTier{Context: ctx, Handler: handler} } -/*AddTier swagger:route POST /admin/tiers AdminAPI addTier +/* AddTier swagger:route POST /admin/tiers AdminAPI addTier Allows to configure a new tier @@ -61,17 +61,16 @@ type AddTier struct { func (o *AddTier) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewAddTierParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *AddTier) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/add_tier_parameters.go b/restapi/operations/admin_api/add_tier_parameters.go index a9cb741dc..77a631ffe 100644 --- a/restapi/operations/admin_api/add_tier_parameters.go +++ b/restapi/operations/admin_api/add_tier_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewAddTierParams creates a new AddTierParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewAddTierParams() AddTierParams { return AddTierParams{} @@ -80,6 +83,11 @@ func (o *AddTierParams) BindRequest(r *http.Request, route *middleware.MatchedRo res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/admin_api/add_user.go b/restapi/operations/admin_api/add_user.go index 3b9ea4f26..c5de50ec3 100644 --- a/restapi/operations/admin_api/add_user.go +++ b/restapi/operations/admin_api/add_user.go @@ -48,7 +48,7 @@ func NewAddUser(ctx *middleware.Context, handler AddUserHandler) *AddUser { return &AddUser{Context: ctx, Handler: handler} } -/*AddUser swagger:route POST /users AdminAPI addUser +/* AddUser swagger:route POST /users AdminAPI addUser Add User @@ -61,17 +61,16 @@ type AddUser struct { func (o *AddUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewAddUserParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *AddUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/add_user_parameters.go b/restapi/operations/admin_api/add_user_parameters.go index 5d0bf9b2f..d51b94d86 100644 --- a/restapi/operations/admin_api/add_user_parameters.go +++ b/restapi/operations/admin_api/add_user_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewAddUserParams creates a new AddUserParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewAddUserParams() AddUserParams { return AddUserParams{} @@ -80,6 +83,11 @@ func (o *AddUserParams) BindRequest(r *http.Request, route *middleware.MatchedRo res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/admin_api/admin_info.go b/restapi/operations/admin_api/admin_info.go index 0e6c56415..24bada7da 100644 --- a/restapi/operations/admin_api/admin_info.go +++ b/restapi/operations/admin_api/admin_info.go @@ -48,7 +48,7 @@ func NewAdminInfo(ctx *middleware.Context, handler AdminInfoHandler) *AdminInfo return &AdminInfo{Context: ctx, Handler: handler} } -/*AdminInfo swagger:route GET /admin/info AdminAPI adminInfo +/* AdminInfo swagger:route GET /admin/info AdminAPI adminInfo Returns information about the deployment @@ -61,17 +61,16 @@ type AdminInfo struct { func (o *AdminInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewAdminInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *AdminInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/admin_info_parameters.go b/restapi/operations/admin_api/admin_info_parameters.go index 25398d3c7..da58fde95 100644 --- a/restapi/operations/admin_api/admin_info_parameters.go +++ b/restapi/operations/admin_api/admin_info_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewAdminInfoParams creates a new AdminInfoParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewAdminInfoParams() AdminInfoParams { return AdminInfoParams{} diff --git a/restapi/operations/admin_api/arn_list.go b/restapi/operations/admin_api/arn_list.go index bc0f32652..3deca17a1 100644 --- a/restapi/operations/admin_api/arn_list.go +++ b/restapi/operations/admin_api/arn_list.go @@ -48,7 +48,7 @@ func NewArnList(ctx *middleware.Context, handler ArnListHandler) *ArnList { return &ArnList{Context: ctx, Handler: handler} } -/*ArnList swagger:route GET /admin/arns AdminAPI arnList +/* ArnList swagger:route GET /admin/arns AdminAPI arnList Returns a list of active ARNs in the instance @@ -61,17 +61,16 @@ type ArnList struct { func (o *ArnList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewArnListParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ArnList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/arn_list_parameters.go b/restapi/operations/admin_api/arn_list_parameters.go index 37e669efb..da8b17776 100644 --- a/restapi/operations/admin_api/arn_list_parameters.go +++ b/restapi/operations/admin_api/arn_list_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewArnListParams creates a new ArnListParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewArnListParams() ArnListParams { return ArnListParams{} diff --git a/restapi/operations/admin_api/bulk_update_users_groups.go b/restapi/operations/admin_api/bulk_update_users_groups.go index b207fe5b6..212a732d5 100644 --- a/restapi/operations/admin_api/bulk_update_users_groups.go +++ b/restapi/operations/admin_api/bulk_update_users_groups.go @@ -48,7 +48,7 @@ func NewBulkUpdateUsersGroups(ctx *middleware.Context, handler BulkUpdateUsersGr return &BulkUpdateUsersGroups{Context: ctx, Handler: handler} } -/*BulkUpdateUsersGroups swagger:route PUT /users-groups-bulk AdminAPI bulkUpdateUsersGroups +/* BulkUpdateUsersGroups swagger:route PUT /users-groups-bulk AdminAPI bulkUpdateUsersGroups Bulk functionality to Add Users to Groups @@ -61,17 +61,16 @@ type BulkUpdateUsersGroups struct { func (o *BulkUpdateUsersGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewBulkUpdateUsersGroupsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *BulkUpdateUsersGroups) ServeHTTP(rw http.ResponseWriter, r *http.Reques } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/bulk_update_users_groups_parameters.go b/restapi/operations/admin_api/bulk_update_users_groups_parameters.go index d736b5ac5..b5f5d89e3 100644 --- a/restapi/operations/admin_api/bulk_update_users_groups_parameters.go +++ b/restapi/operations/admin_api/bulk_update_users_groups_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewBulkUpdateUsersGroupsParams creates a new BulkUpdateUsersGroupsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewBulkUpdateUsersGroupsParams() BulkUpdateUsersGroupsParams { return BulkUpdateUsersGroupsParams{} @@ -80,6 +83,11 @@ func (o *BulkUpdateUsersGroupsParams) BindRequest(r *http.Request, route *middle res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/admin_api/change_user_password.go b/restapi/operations/admin_api/change_user_password.go index 53480eda3..1b6e85681 100644 --- a/restapi/operations/admin_api/change_user_password.go +++ b/restapi/operations/admin_api/change_user_password.go @@ -48,7 +48,7 @@ func NewChangeUserPassword(ctx *middleware.Context, handler ChangeUserPasswordHa return &ChangeUserPassword{Context: ctx, Handler: handler} } -/*ChangeUserPassword swagger:route POST /account/change-user-password AdminAPI changeUserPassword +/* ChangeUserPassword swagger:route POST /account/change-user-password AdminAPI changeUserPassword Change password of currently logged in user. @@ -61,17 +61,16 @@ type ChangeUserPassword struct { func (o *ChangeUserPassword) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewChangeUserPasswordParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ChangeUserPassword) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/change_user_password_parameters.go b/restapi/operations/admin_api/change_user_password_parameters.go index 3260b2166..1e9d29155 100644 --- a/restapi/operations/admin_api/change_user_password_parameters.go +++ b/restapi/operations/admin_api/change_user_password_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewChangeUserPasswordParams creates a new ChangeUserPasswordParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewChangeUserPasswordParams() ChangeUserPasswordParams { return ChangeUserPasswordParams{} @@ -80,6 +83,11 @@ func (o *ChangeUserPasswordParams) BindRequest(r *http.Request, route *middlewar res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/admin_api/config_info.go b/restapi/operations/admin_api/config_info.go index ed5e314fa..3202e4ba7 100644 --- a/restapi/operations/admin_api/config_info.go +++ b/restapi/operations/admin_api/config_info.go @@ -48,7 +48,7 @@ func NewConfigInfo(ctx *middleware.Context, handler ConfigInfoHandler) *ConfigIn return &ConfigInfo{Context: ctx, Handler: handler} } -/*ConfigInfo swagger:route GET /configs/{name} AdminAPI configInfo +/* ConfigInfo swagger:route GET /configs/{name} AdminAPI configInfo Configuration info @@ -61,17 +61,16 @@ type ConfigInfo struct { func (o *ConfigInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewConfigInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ConfigInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/config_info_parameters.go b/restapi/operations/admin_api/config_info_parameters.go index cdcb03e47..374916435 100644 --- a/restapi/operations/admin_api/config_info_parameters.go +++ b/restapi/operations/admin_api/config_info_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewConfigInfoParams creates a new ConfigInfoParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewConfigInfoParams() ConfigInfoParams { return ConfigInfoParams{} @@ -66,7 +67,6 @@ func (o *ConfigInfoParams) BindRequest(r *http.Request, route *middleware.Matche if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *ConfigInfoParams) bindName(rawData []string, hasKey bool, formats strfm // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/admin_api/create_tenant.go b/restapi/operations/admin_api/create_tenant.go index e599f01ee..5b3922d8d 100644 --- a/restapi/operations/admin_api/create_tenant.go +++ b/restapi/operations/admin_api/create_tenant.go @@ -48,7 +48,7 @@ func NewCreateTenant(ctx *middleware.Context, handler CreateTenantHandler) *Crea return &CreateTenant{Context: ctx, Handler: handler} } -/*CreateTenant swagger:route POST /tenants AdminAPI createTenant +/* CreateTenant swagger:route POST /tenants AdminAPI createTenant Create Tenant @@ -61,17 +61,16 @@ type CreateTenant struct { func (o *CreateTenant) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewCreateTenantParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *CreateTenant) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/create_tenant_parameters.go b/restapi/operations/admin_api/create_tenant_parameters.go index e017d410b..08a83b5f4 100644 --- a/restapi/operations/admin_api/create_tenant_parameters.go +++ b/restapi/operations/admin_api/create_tenant_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewCreateTenantParams creates a new CreateTenantParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewCreateTenantParams() CreateTenantParams { return CreateTenantParams{} @@ -80,6 +83,11 @@ func (o *CreateTenantParams) BindRequest(r *http.Request, route *middleware.Matc res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/admin_api/dashboard_widget_details.go b/restapi/operations/admin_api/dashboard_widget_details.go index 681b339d7..c523faf5f 100644 --- a/restapi/operations/admin_api/dashboard_widget_details.go +++ b/restapi/operations/admin_api/dashboard_widget_details.go @@ -48,7 +48,7 @@ func NewDashboardWidgetDetails(ctx *middleware.Context, handler DashboardWidgetD return &DashboardWidgetDetails{Context: ctx, Handler: handler} } -/*DashboardWidgetDetails swagger:route GET /admin/info/widgets/{widgetId} AdminAPI dashboardWidgetDetails +/* DashboardWidgetDetails swagger:route GET /admin/info/widgets/{widgetId} AdminAPI dashboardWidgetDetails Returns information about the deployment @@ -61,17 +61,16 @@ type DashboardWidgetDetails struct { func (o *DashboardWidgetDetails) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDashboardWidgetDetailsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DashboardWidgetDetails) ServeHTTP(rw http.ResponseWriter, r *http.Reque } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/dashboard_widget_details_parameters.go b/restapi/operations/admin_api/dashboard_widget_details_parameters.go index 08d8f101c..3a3a2f016 100644 --- a/restapi/operations/admin_api/dashboard_widget_details_parameters.go +++ b/restapi/operations/admin_api/dashboard_widget_details_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewDashboardWidgetDetailsParams creates a new DashboardWidgetDetailsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDashboardWidgetDetailsParams() DashboardWidgetDetailsParams { return DashboardWidgetDetailsParams{} @@ -97,7 +98,6 @@ func (o *DashboardWidgetDetailsParams) BindRequest(r *http.Request, route *middl if err := o.bindWidgetID(rWidgetID, rhkWidgetID, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,6 +113,7 @@ func (o *DashboardWidgetDetailsParams) bindEnd(rawData []string, hasKey bool, fo // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -135,6 +136,7 @@ func (o *DashboardWidgetDetailsParams) bindStart(rawData []string, hasKey bool, // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -157,6 +159,7 @@ func (o *DashboardWidgetDetailsParams) bindStep(rawData []string, hasKey bool, f // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } diff --git a/restapi/operations/admin_api/delete_tenant.go b/restapi/operations/admin_api/delete_tenant.go index cd807693f..63e62db75 100644 --- a/restapi/operations/admin_api/delete_tenant.go +++ b/restapi/operations/admin_api/delete_tenant.go @@ -48,7 +48,7 @@ func NewDeleteTenant(ctx *middleware.Context, handler DeleteTenantHandler) *Dele return &DeleteTenant{Context: ctx, Handler: handler} } -/*DeleteTenant swagger:route DELETE /namespaces/{namespace}/tenants/{tenant} AdminAPI deleteTenant +/* DeleteTenant swagger:route DELETE /namespaces/{namespace}/tenants/{tenant} AdminAPI deleteTenant Delete tenant and underlying pvcs @@ -61,17 +61,16 @@ type DeleteTenant struct { func (o *DeleteTenant) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDeleteTenantParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DeleteTenant) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/delete_tenant_parameters.go b/restapi/operations/admin_api/delete_tenant_parameters.go index a9fcb2a5b..cf4b5e854 100644 --- a/restapi/operations/admin_api/delete_tenant_parameters.go +++ b/restapi/operations/admin_api/delete_tenant_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewDeleteTenantParams creates a new DeleteTenantParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDeleteTenantParams() DeleteTenantParams { return DeleteTenantParams{} @@ -85,11 +88,17 @@ func (o *DeleteTenantParams) BindRequest(r *http.Request, route *middleware.Matc res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } } } + rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { res = append(res, err) @@ -99,7 +108,6 @@ func (o *DeleteTenantParams) BindRequest(r *http.Request, route *middleware.Matc if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -115,7 +123,6 @@ func (o *DeleteTenantParams) bindNamespace(rawData []string, hasKey bool, format // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -130,7 +137,6 @@ func (o *DeleteTenantParams) bindTenant(rawData []string, hasKey bool, formats s // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/direct_c_s_i_format_drive.go b/restapi/operations/admin_api/direct_c_s_i_format_drive.go index a65ad366d..27f627e0c 100644 --- a/restapi/operations/admin_api/direct_c_s_i_format_drive.go +++ b/restapi/operations/admin_api/direct_c_s_i_format_drive.go @@ -48,7 +48,7 @@ func NewDirectCSIFormatDrive(ctx *middleware.Context, handler DirectCSIFormatDri return &DirectCSIFormatDrive{Context: ctx, Handler: handler} } -/*DirectCSIFormatDrive swagger:route POST /direct-csi/drives/format AdminAPI directCSIFormatDrive +/* DirectCSIFormatDrive swagger:route POST /direct-csi/drives/format AdminAPI directCSIFormatDrive Format direct-csi drives from a list @@ -61,17 +61,16 @@ type DirectCSIFormatDrive struct { func (o *DirectCSIFormatDrive) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDirectCSIFormatDriveParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DirectCSIFormatDrive) ServeHTTP(rw http.ResponseWriter, r *http.Request } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/direct_c_s_i_format_drive_parameters.go b/restapi/operations/admin_api/direct_c_s_i_format_drive_parameters.go index 3cb9eaa80..7712ee97a 100644 --- a/restapi/operations/admin_api/direct_c_s_i_format_drive_parameters.go +++ b/restapi/operations/admin_api/direct_c_s_i_format_drive_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewDirectCSIFormatDriveParams creates a new DirectCSIFormatDriveParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDirectCSIFormatDriveParams() DirectCSIFormatDriveParams { return DirectCSIFormatDriveParams{} @@ -80,6 +83,11 @@ func (o *DirectCSIFormatDriveParams) BindRequest(r *http.Request, route *middlew res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/admin_api/edit_tier_credentials.go b/restapi/operations/admin_api/edit_tier_credentials.go index c9ecfff05..600475f6a 100644 --- a/restapi/operations/admin_api/edit_tier_credentials.go +++ b/restapi/operations/admin_api/edit_tier_credentials.go @@ -48,7 +48,7 @@ func NewEditTierCredentials(ctx *middleware.Context, handler EditTierCredentials return &EditTierCredentials{Context: ctx, Handler: handler} } -/*EditTierCredentials swagger:route PUT /admin/tiers/{type}/{name}/credentials AdminAPI editTierCredentials +/* EditTierCredentials swagger:route PUT /admin/tiers/{type}/{name}/credentials AdminAPI editTierCredentials Edit Tier Credentials @@ -61,17 +61,16 @@ type EditTierCredentials struct { func (o *EditTierCredentials) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewEditTierCredentialsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *EditTierCredentials) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/edit_tier_credentials_parameters.go b/restapi/operations/admin_api/edit_tier_credentials_parameters.go index b171aee70..a24a916bf 100644 --- a/restapi/operations/admin_api/edit_tier_credentials_parameters.go +++ b/restapi/operations/admin_api/edit_tier_credentials_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -36,7 +37,8 @@ import ( ) // NewEditTierCredentialsParams creates a new EditTierCredentialsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewEditTierCredentialsParams() EditTierCredentialsParams { return EditTierCredentialsParams{} @@ -92,6 +94,11 @@ func (o *EditTierCredentialsParams) BindRequest(r *http.Request, route *middlewa res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -99,6 +106,7 @@ func (o *EditTierCredentialsParams) BindRequest(r *http.Request, route *middlewa } else { res = append(res, errors.Required("body", "body", "")) } + rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) @@ -108,7 +116,6 @@ func (o *EditTierCredentialsParams) BindRequest(r *http.Request, route *middlewa if err := o.bindType(rType, rhkType, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -124,7 +131,6 @@ func (o *EditTierCredentialsParams) bindName(rawData []string, hasKey bool, form // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil @@ -139,7 +145,6 @@ func (o *EditTierCredentialsParams) bindType(rawData []string, hasKey bool, form // Required: true // Parameter is provided by construction from the route - o.Type = raw if err := o.validateType(formats); err != nil { diff --git a/restapi/operations/admin_api/get_direct_c_s_i_drive_list.go b/restapi/operations/admin_api/get_direct_c_s_i_drive_list.go index e17b20b7c..8e32ae5f4 100644 --- a/restapi/operations/admin_api/get_direct_c_s_i_drive_list.go +++ b/restapi/operations/admin_api/get_direct_c_s_i_drive_list.go @@ -48,7 +48,7 @@ func NewGetDirectCSIDriveList(ctx *middleware.Context, handler GetDirectCSIDrive return &GetDirectCSIDriveList{Context: ctx, Handler: handler} } -/*GetDirectCSIDriveList swagger:route GET /direct-csi/drives AdminAPI getDirectCSIDriveList +/* GetDirectCSIDriveList swagger:route GET /direct-csi/drives AdminAPI getDirectCSIDriveList Get direct-csi drives list @@ -61,17 +61,16 @@ type GetDirectCSIDriveList struct { func (o *GetDirectCSIDriveList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetDirectCSIDriveListParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetDirectCSIDriveList) ServeHTTP(rw http.ResponseWriter, r *http.Reques } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/get_direct_c_s_i_drive_list_parameters.go b/restapi/operations/admin_api/get_direct_c_s_i_drive_list_parameters.go index 2792ad20b..db9c2027d 100644 --- a/restapi/operations/admin_api/get_direct_c_s_i_drive_list_parameters.go +++ b/restapi/operations/admin_api/get_direct_c_s_i_drive_list_parameters.go @@ -32,7 +32,8 @@ import ( ) // NewGetDirectCSIDriveListParams creates a new GetDirectCSIDriveListParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetDirectCSIDriveListParams() GetDirectCSIDriveListParams { return GetDirectCSIDriveListParams{} @@ -77,7 +78,6 @@ func (o *GetDirectCSIDriveListParams) BindRequest(r *http.Request, route *middle if err := o.bindNodes(qNodes, qhkNodes, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -93,10 +93,10 @@ func (o *GetDirectCSIDriveListParams) bindDrives(rawData []string, hasKey bool, // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.Drives = &raw return nil @@ -111,10 +111,10 @@ func (o *GetDirectCSIDriveListParams) bindNodes(rawData []string, hasKey bool, f // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.Nodes = &raw return nil diff --git a/restapi/operations/admin_api/get_direct_c_s_i_volume_list.go b/restapi/operations/admin_api/get_direct_c_s_i_volume_list.go index 36ee32ed7..0a01524d1 100644 --- a/restapi/operations/admin_api/get_direct_c_s_i_volume_list.go +++ b/restapi/operations/admin_api/get_direct_c_s_i_volume_list.go @@ -48,7 +48,7 @@ func NewGetDirectCSIVolumeList(ctx *middleware.Context, handler GetDirectCSIVolu return &GetDirectCSIVolumeList{Context: ctx, Handler: handler} } -/*GetDirectCSIVolumeList swagger:route GET /direct-csi/volumes AdminAPI getDirectCSIVolumeList +/* GetDirectCSIVolumeList swagger:route GET /direct-csi/volumes AdminAPI getDirectCSIVolumeList Get direct-csi volumes list @@ -61,17 +61,16 @@ type GetDirectCSIVolumeList struct { func (o *GetDirectCSIVolumeList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetDirectCSIVolumeListParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetDirectCSIVolumeList) ServeHTTP(rw http.ResponseWriter, r *http.Reque } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/get_direct_c_s_i_volume_list_parameters.go b/restapi/operations/admin_api/get_direct_c_s_i_volume_list_parameters.go index d328b8cfa..c5385306f 100644 --- a/restapi/operations/admin_api/get_direct_c_s_i_volume_list_parameters.go +++ b/restapi/operations/admin_api/get_direct_c_s_i_volume_list_parameters.go @@ -32,7 +32,8 @@ import ( ) // NewGetDirectCSIVolumeListParams creates a new GetDirectCSIVolumeListParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetDirectCSIVolumeListParams() GetDirectCSIVolumeListParams { return GetDirectCSIVolumeListParams{} @@ -77,7 +78,6 @@ func (o *GetDirectCSIVolumeListParams) BindRequest(r *http.Request, route *middl if err := o.bindNodes(qNodes, qhkNodes, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -93,10 +93,10 @@ func (o *GetDirectCSIVolumeListParams) bindDrives(rawData []string, hasKey bool, // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.Drives = &raw return nil @@ -111,10 +111,10 @@ func (o *GetDirectCSIVolumeListParams) bindNodes(rawData []string, hasKey bool, // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.Nodes = &raw return nil diff --git a/restapi/operations/admin_api/get_max_allocatable_mem.go b/restapi/operations/admin_api/get_max_allocatable_mem.go index fb5cc6959..f939652a9 100644 --- a/restapi/operations/admin_api/get_max_allocatable_mem.go +++ b/restapi/operations/admin_api/get_max_allocatable_mem.go @@ -48,7 +48,7 @@ func NewGetMaxAllocatableMem(ctx *middleware.Context, handler GetMaxAllocatableM return &GetMaxAllocatableMem{Context: ctx, Handler: handler} } -/*GetMaxAllocatableMem swagger:route GET /cluster/max-allocatable-memory AdminAPI getMaxAllocatableMem +/* GetMaxAllocatableMem swagger:route GET /cluster/max-allocatable-memory AdminAPI getMaxAllocatableMem Get maximum allocatable memory for given number of nodes @@ -61,17 +61,16 @@ type GetMaxAllocatableMem struct { func (o *GetMaxAllocatableMem) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetMaxAllocatableMemParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetMaxAllocatableMem) ServeHTTP(rw http.ResponseWriter, r *http.Request } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/get_max_allocatable_mem_parameters.go b/restapi/operations/admin_api/get_max_allocatable_mem_parameters.go index 1e75000cc..00ffc7985 100644 --- a/restapi/operations/admin_api/get_max_allocatable_mem_parameters.go +++ b/restapi/operations/admin_api/get_max_allocatable_mem_parameters.go @@ -34,7 +34,8 @@ import ( ) // NewGetMaxAllocatableMemParams creates a new GetMaxAllocatableMemParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetMaxAllocatableMemParams() GetMaxAllocatableMemParams { return GetMaxAllocatableMemParams{} @@ -72,7 +73,6 @@ func (o *GetMaxAllocatableMemParams) BindRequest(r *http.Request, route *middlew if err := o.bindNumNodes(qNumNodes, qhkNumNodes, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -91,6 +91,7 @@ func (o *GetMaxAllocatableMemParams) bindNumNodes(rawData []string, hasKey bool, // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("num_nodes", "query", raw); err != nil { return err } diff --git a/restapi/operations/admin_api/get_parity.go b/restapi/operations/admin_api/get_parity.go index 4df3bef38..6301184fa 100644 --- a/restapi/operations/admin_api/get_parity.go +++ b/restapi/operations/admin_api/get_parity.go @@ -48,7 +48,7 @@ func NewGetParity(ctx *middleware.Context, handler GetParityHandler) *GetParity return &GetParity{Context: ctx, Handler: handler} } -/*GetParity swagger:route GET /get-parity/{nodes}/{disksPerNode} AdminAPI getParity +/* GetParity swagger:route GET /get-parity/{nodes}/{disksPerNode} AdminAPI getParity Gets parity by sending number of nodes & number of disks @@ -61,17 +61,16 @@ type GetParity struct { func (o *GetParity) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetParityParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetParity) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/get_parity_parameters.go b/restapi/operations/admin_api/get_parity_parameters.go index c3f14fa7c..9fe461214 100644 --- a/restapi/operations/admin_api/get_parity_parameters.go +++ b/restapi/operations/admin_api/get_parity_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewGetParityParams creates a new GetParityParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetParityParams() GetParityParams { return GetParityParams{} @@ -80,7 +81,6 @@ func (o *GetParityParams) BindRequest(r *http.Request, route *middleware.Matched if err := o.bindNodes(rNodes, rhkNodes, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +113,7 @@ func (o *GetParityParams) bindDisksPerNode(rawData []string, hasKey bool, format // validateDisksPerNode carries on validations for parameter DisksPerNode func (o *GetParityParams) validateDisksPerNode(formats strfmt.Registry) error { - if err := validate.MinimumInt("disksPerNode", "path", int64(o.DisksPerNode), 1, false); err != nil { + if err := validate.MinimumInt("disksPerNode", "path", o.DisksPerNode, 1, false); err != nil { return err } @@ -146,7 +146,7 @@ func (o *GetParityParams) bindNodes(rawData []string, hasKey bool, formats strfm // validateNodes carries on validations for parameter Nodes func (o *GetParityParams) validateNodes(formats strfmt.Registry) error { - if err := validate.MinimumInt("nodes", "path", int64(o.Nodes), 2, false); err != nil { + if err := validate.MinimumInt("nodes", "path", o.Nodes, 2, false); err != nil { return err } diff --git a/restapi/operations/admin_api/get_pod_logs.go b/restapi/operations/admin_api/get_pod_logs.go index c47bb1e82..bde148f92 100644 --- a/restapi/operations/admin_api/get_pod_logs.go +++ b/restapi/operations/admin_api/get_pod_logs.go @@ -48,7 +48,7 @@ func NewGetPodLogs(ctx *middleware.Context, handler GetPodLogsHandler) *GetPodLo return &GetPodLogs{Context: ctx, Handler: handler} } -/*GetPodLogs swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods/{podName} AdminAPI getPodLogs +/* GetPodLogs swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods/{podName} AdminAPI getPodLogs Get Logs for Pod @@ -61,17 +61,16 @@ type GetPodLogs struct { func (o *GetPodLogs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetPodLogsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetPodLogs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/get_pod_logs_parameters.go b/restapi/operations/admin_api/get_pod_logs_parameters.go index bbbfa9b7b..fe2c1a5b2 100644 --- a/restapi/operations/admin_api/get_pod_logs_parameters.go +++ b/restapi/operations/admin_api/get_pod_logs_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetPodLogsParams creates a new GetPodLogsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetPodLogsParams() GetPodLogsParams { return GetPodLogsParams{} @@ -86,7 +87,6 @@ func (o *GetPodLogsParams) BindRequest(r *http.Request, route *middleware.Matche if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -102,7 +102,6 @@ func (o *GetPodLogsParams) bindNamespace(rawData []string, hasKey bool, formats // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -117,7 +116,6 @@ func (o *GetPodLogsParams) bindPodName(rawData []string, hasKey bool, formats st // Required: true // Parameter is provided by construction from the route - o.PodName = raw return nil @@ -132,7 +130,6 @@ func (o *GetPodLogsParams) bindTenant(rawData []string, hasKey bool, formats str // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/get_resource_quota.go b/restapi/operations/admin_api/get_resource_quota.go index 7b12ca86e..f879f37ed 100644 --- a/restapi/operations/admin_api/get_resource_quota.go +++ b/restapi/operations/admin_api/get_resource_quota.go @@ -48,7 +48,7 @@ func NewGetResourceQuota(ctx *middleware.Context, handler GetResourceQuotaHandle return &GetResourceQuota{Context: ctx, Handler: handler} } -/*GetResourceQuota swagger:route GET /namespaces/{namespace}/resourcequotas/{resource-quota-name} AdminAPI getResourceQuota +/* GetResourceQuota swagger:route GET /namespaces/{namespace}/resourcequotas/{resource-quota-name} AdminAPI getResourceQuota Get Resource Quota @@ -61,17 +61,16 @@ type GetResourceQuota struct { func (o *GetResourceQuota) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetResourceQuotaParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetResourceQuota) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/get_resource_quota_parameters.go b/restapi/operations/admin_api/get_resource_quota_parameters.go index 72d45c47f..8a3f2d129 100644 --- a/restapi/operations/admin_api/get_resource_quota_parameters.go +++ b/restapi/operations/admin_api/get_resource_quota_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetResourceQuotaParams creates a new GetResourceQuotaParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetResourceQuotaParams() GetResourceQuotaParams { return GetResourceQuotaParams{} @@ -76,7 +77,6 @@ func (o *GetResourceQuotaParams) BindRequest(r *http.Request, route *middleware. if err := o.bindResourceQuotaName(rResourceQuotaName, rhkResourceQuotaName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -92,7 +92,6 @@ func (o *GetResourceQuotaParams) bindNamespace(rawData []string, hasKey bool, fo // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -107,7 +106,6 @@ func (o *GetResourceQuotaParams) bindResourceQuotaName(rawData []string, hasKey // Required: true // Parameter is provided by construction from the route - o.ResourceQuotaName = raw return nil diff --git a/restapi/operations/admin_api/get_tenant_pods.go b/restapi/operations/admin_api/get_tenant_pods.go index 3bc6ae0c5..3d17111a5 100644 --- a/restapi/operations/admin_api/get_tenant_pods.go +++ b/restapi/operations/admin_api/get_tenant_pods.go @@ -48,7 +48,7 @@ func NewGetTenantPods(ctx *middleware.Context, handler GetTenantPodsHandler) *Ge return &GetTenantPods{Context: ctx, Handler: handler} } -/*GetTenantPods swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods AdminAPI getTenantPods +/* GetTenantPods swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods AdminAPI getTenantPods Get Pods For The Tenant @@ -61,17 +61,16 @@ type GetTenantPods struct { func (o *GetTenantPods) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetTenantPodsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetTenantPods) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/get_tenant_pods_parameters.go b/restapi/operations/admin_api/get_tenant_pods_parameters.go index 7651789ac..1f63b7f17 100644 --- a/restapi/operations/admin_api/get_tenant_pods_parameters.go +++ b/restapi/operations/admin_api/get_tenant_pods_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetTenantPodsParams creates a new GetTenantPodsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetTenantPodsParams() GetTenantPodsParams { return GetTenantPodsParams{} @@ -76,7 +77,6 @@ func (o *GetTenantPodsParams) BindRequest(r *http.Request, route *middleware.Mat if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -92,7 +92,6 @@ func (o *GetTenantPodsParams) bindNamespace(rawData []string, hasKey bool, forma // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -107,7 +106,6 @@ func (o *GetTenantPodsParams) bindTenant(rawData []string, hasKey bool, formats // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/get_tenant_usage.go b/restapi/operations/admin_api/get_tenant_usage.go index 2ebe450a0..2ae0a69a4 100644 --- a/restapi/operations/admin_api/get_tenant_usage.go +++ b/restapi/operations/admin_api/get_tenant_usage.go @@ -48,7 +48,7 @@ func NewGetTenantUsage(ctx *middleware.Context, handler GetTenantUsageHandler) * return &GetTenantUsage{Context: ctx, Handler: handler} } -/*GetTenantUsage swagger:route GET /namespaces/{namespace}/tenants/{tenant}/usage AdminAPI getTenantUsage +/* GetTenantUsage swagger:route GET /namespaces/{namespace}/tenants/{tenant}/usage AdminAPI getTenantUsage Get Usage For The Tenant @@ -61,17 +61,16 @@ type GetTenantUsage struct { func (o *GetTenantUsage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetTenantUsageParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetTenantUsage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/get_tenant_usage_parameters.go b/restapi/operations/admin_api/get_tenant_usage_parameters.go index 9028eb4b6..acee771e0 100644 --- a/restapi/operations/admin_api/get_tenant_usage_parameters.go +++ b/restapi/operations/admin_api/get_tenant_usage_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetTenantUsageParams creates a new GetTenantUsageParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetTenantUsageParams() GetTenantUsageParams { return GetTenantUsageParams{} @@ -76,7 +77,6 @@ func (o *GetTenantUsageParams) BindRequest(r *http.Request, route *middleware.Ma if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -92,7 +92,6 @@ func (o *GetTenantUsageParams) bindNamespace(rawData []string, hasKey bool, form // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -107,7 +106,6 @@ func (o *GetTenantUsageParams) bindTenant(rawData []string, hasKey bool, formats // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/get_tenant_y_a_m_l.go b/restapi/operations/admin_api/get_tenant_y_a_m_l.go index 91b598c5d..0a527d30c 100644 --- a/restapi/operations/admin_api/get_tenant_y_a_m_l.go +++ b/restapi/operations/admin_api/get_tenant_y_a_m_l.go @@ -48,7 +48,7 @@ func NewGetTenantYAML(ctx *middleware.Context, handler GetTenantYAMLHandler) *Ge return &GetTenantYAML{Context: ctx, Handler: handler} } -/*GetTenantYAML swagger:route GET /namespaces/{namespace}/tenants/{tenant}/yaml AdminAPI getTenantYAML +/* GetTenantYAML swagger:route GET /namespaces/{namespace}/tenants/{tenant}/yaml AdminAPI getTenantYAML Get the Tenant YAML @@ -61,17 +61,16 @@ type GetTenantYAML struct { func (o *GetTenantYAML) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetTenantYAMLParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetTenantYAML) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/get_tenant_y_a_m_l_parameters.go b/restapi/operations/admin_api/get_tenant_y_a_m_l_parameters.go index 257569201..1e35a13fe 100644 --- a/restapi/operations/admin_api/get_tenant_y_a_m_l_parameters.go +++ b/restapi/operations/admin_api/get_tenant_y_a_m_l_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetTenantYAMLParams creates a new GetTenantYAMLParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetTenantYAMLParams() GetTenantYAMLParams { return GetTenantYAMLParams{} @@ -76,7 +77,6 @@ func (o *GetTenantYAMLParams) BindRequest(r *http.Request, route *middleware.Mat if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -92,7 +92,6 @@ func (o *GetTenantYAMLParams) bindNamespace(rawData []string, hasKey bool, forma // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -107,7 +106,6 @@ func (o *GetTenantYAMLParams) bindTenant(rawData []string, hasKey bool, formats // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/get_tier.go b/restapi/operations/admin_api/get_tier.go index 3a644754d..5c08aa650 100644 --- a/restapi/operations/admin_api/get_tier.go +++ b/restapi/operations/admin_api/get_tier.go @@ -48,7 +48,7 @@ func NewGetTier(ctx *middleware.Context, handler GetTierHandler) *GetTier { return &GetTier{Context: ctx, Handler: handler} } -/*GetTier swagger:route GET /admin/tiers/{type}/{name} AdminAPI getTier +/* GetTier swagger:route GET /admin/tiers/{type}/{name} AdminAPI getTier Get Tier @@ -61,17 +61,16 @@ type GetTier struct { func (o *GetTier) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetTierParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetTier) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/get_tier_parameters.go b/restapi/operations/admin_api/get_tier_parameters.go index 0fd4f9431..4594f3ee3 100644 --- a/restapi/operations/admin_api/get_tier_parameters.go +++ b/restapi/operations/admin_api/get_tier_parameters.go @@ -32,7 +32,8 @@ import ( ) // NewGetTierParams creates a new GetTierParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetTierParams() GetTierParams { return GetTierParams{} @@ -77,7 +78,6 @@ func (o *GetTierParams) BindRequest(r *http.Request, route *middleware.MatchedRo if err := o.bindType(rType, rhkType, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -93,7 +93,6 @@ func (o *GetTierParams) bindName(rawData []string, hasKey bool, formats strfmt.R // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil @@ -108,7 +107,6 @@ func (o *GetTierParams) bindType(rawData []string, hasKey bool, formats strfmt.R // Required: true // Parameter is provided by construction from the route - o.Type = raw if err := o.validateType(formats); err != nil { diff --git a/restapi/operations/admin_api/get_user_info.go b/restapi/operations/admin_api/get_user_info.go index 3626c1a39..8262f51f6 100644 --- a/restapi/operations/admin_api/get_user_info.go +++ b/restapi/operations/admin_api/get_user_info.go @@ -48,7 +48,7 @@ func NewGetUserInfo(ctx *middleware.Context, handler GetUserInfoHandler) *GetUse return &GetUserInfo{Context: ctx, Handler: handler} } -/*GetUserInfo swagger:route GET /users/{name} AdminAPI getUserInfo +/* GetUserInfo swagger:route GET /users/{name} AdminAPI getUserInfo Get User Info @@ -61,17 +61,16 @@ type GetUserInfo struct { func (o *GetUserInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetUserInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetUserInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/get_user_info_parameters.go b/restapi/operations/admin_api/get_user_info_parameters.go index e71d05804..e4f11cea6 100644 --- a/restapi/operations/admin_api/get_user_info_parameters.go +++ b/restapi/operations/admin_api/get_user_info_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetUserInfoParams creates a new GetUserInfoParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetUserInfoParams() GetUserInfoParams { return GetUserInfoParams{} @@ -66,7 +67,6 @@ func (o *GetUserInfoParams) BindRequest(r *http.Request, route *middleware.Match if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *GetUserInfoParams) bindName(rawData []string, hasKey bool, formats strf // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/admin_api/group_info.go b/restapi/operations/admin_api/group_info.go index dfc8a7c06..39ed61cdf 100644 --- a/restapi/operations/admin_api/group_info.go +++ b/restapi/operations/admin_api/group_info.go @@ -48,7 +48,7 @@ func NewGroupInfo(ctx *middleware.Context, handler GroupInfoHandler) *GroupInfo return &GroupInfo{Context: ctx, Handler: handler} } -/*GroupInfo swagger:route GET /groups/{name} AdminAPI groupInfo +/* GroupInfo swagger:route GET /groups/{name} AdminAPI groupInfo Group info @@ -61,17 +61,16 @@ type GroupInfo struct { func (o *GroupInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGroupInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GroupInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/group_info_parameters.go b/restapi/operations/admin_api/group_info_parameters.go index 79853770c..fad0fba7e 100644 --- a/restapi/operations/admin_api/group_info_parameters.go +++ b/restapi/operations/admin_api/group_info_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGroupInfoParams creates a new GroupInfoParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGroupInfoParams() GroupInfoParams { return GroupInfoParams{} @@ -66,7 +67,6 @@ func (o *GroupInfoParams) BindRequest(r *http.Request, route *middleware.Matched if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *GroupInfoParams) bindName(rawData []string, hasKey bool, formats strfmt // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/admin_api/list_a_user_service_accounts.go b/restapi/operations/admin_api/list_a_user_service_accounts.go index 9b61db3ba..b7f1eba1b 100644 --- a/restapi/operations/admin_api/list_a_user_service_accounts.go +++ b/restapi/operations/admin_api/list_a_user_service_accounts.go @@ -48,7 +48,7 @@ func NewListAUserServiceAccounts(ctx *middleware.Context, handler ListAUserServi return &ListAUserServiceAccounts{Context: ctx, Handler: handler} } -/*ListAUserServiceAccounts swagger:route GET /users/{name}/service-accounts AdminAPI listAUserServiceAccounts +/* ListAUserServiceAccounts swagger:route GET /users/{name}/service-accounts AdminAPI listAUserServiceAccounts returns a list of service accounts for a user @@ -61,17 +61,16 @@ type ListAUserServiceAccounts struct { func (o *ListAUserServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListAUserServiceAccountsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListAUserServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Req } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/list_a_user_service_accounts_parameters.go b/restapi/operations/admin_api/list_a_user_service_accounts_parameters.go index 2cdd37d6d..e48afe686 100644 --- a/restapi/operations/admin_api/list_a_user_service_accounts_parameters.go +++ b/restapi/operations/admin_api/list_a_user_service_accounts_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewListAUserServiceAccountsParams creates a new ListAUserServiceAccountsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListAUserServiceAccountsParams() ListAUserServiceAccountsParams { return ListAUserServiceAccountsParams{} @@ -66,7 +67,6 @@ func (o *ListAUserServiceAccountsParams) BindRequest(r *http.Request, route *mid if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *ListAUserServiceAccountsParams) bindName(rawData []string, hasKey bool, // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/admin_api/list_all_tenants.go b/restapi/operations/admin_api/list_all_tenants.go index 88ccdf7ec..86ee07305 100644 --- a/restapi/operations/admin_api/list_all_tenants.go +++ b/restapi/operations/admin_api/list_all_tenants.go @@ -48,7 +48,7 @@ func NewListAllTenants(ctx *middleware.Context, handler ListAllTenantsHandler) * return &ListAllTenants{Context: ctx, Handler: handler} } -/*ListAllTenants swagger:route GET /tenants AdminAPI listAllTenants +/* ListAllTenants swagger:route GET /tenants AdminAPI listAllTenants List Tenant of All Namespaces @@ -61,17 +61,16 @@ type ListAllTenants struct { func (o *ListAllTenants) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListAllTenantsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListAllTenants) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/list_all_tenants_parameters.go b/restapi/operations/admin_api/list_all_tenants_parameters.go index 97feb2841..eb6670ba0 100644 --- a/restapi/operations/admin_api/list_all_tenants_parameters.go +++ b/restapi/operations/admin_api/list_all_tenants_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListAllTenantsParams creates a new ListAllTenantsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListAllTenantsParams() ListAllTenantsParams { return ListAllTenantsParams{} @@ -87,7 +88,6 @@ func (o *ListAllTenantsParams) BindRequest(r *http.Request, route *middleware.Ma if err := o.bindSortBy(qSortBy, qhkSortBy, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -103,6 +103,7 @@ func (o *ListAllTenantsParams) bindLimit(rawData []string, hasKey bool, formats // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -125,6 +126,7 @@ func (o *ListAllTenantsParams) bindOffset(rawData []string, hasKey bool, formats // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -147,10 +149,10 @@ func (o *ListAllTenantsParams) bindSortBy(rawData []string, hasKey bool, formats // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.SortBy = &raw return nil diff --git a/restapi/operations/admin_api/list_config.go b/restapi/operations/admin_api/list_config.go index 881e39bad..6b7e9f1e4 100644 --- a/restapi/operations/admin_api/list_config.go +++ b/restapi/operations/admin_api/list_config.go @@ -48,7 +48,7 @@ func NewListConfig(ctx *middleware.Context, handler ListConfigHandler) *ListConf return &ListConfig{Context: ctx, Handler: handler} } -/*ListConfig swagger:route GET /configs AdminAPI listConfig +/* ListConfig swagger:route GET /configs AdminAPI listConfig List Configurations @@ -61,17 +61,16 @@ type ListConfig struct { func (o *ListConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListConfigParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/list_config_parameters.go b/restapi/operations/admin_api/list_config_parameters.go index 9fe917f5d..ce64470fb 100644 --- a/restapi/operations/admin_api/list_config_parameters.go +++ b/restapi/operations/admin_api/list_config_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListConfigParams creates a new ListConfigParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListConfigParams() ListConfigParams { return ListConfigParams{} @@ -78,7 +79,6 @@ func (o *ListConfigParams) BindRequest(r *http.Request, route *middleware.Matche if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -94,6 +94,7 @@ func (o *ListConfigParams) bindLimit(rawData []string, hasKey bool, formats strf // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -116,6 +117,7 @@ func (o *ListConfigParams) bindOffset(rawData []string, hasKey bool, formats str // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } diff --git a/restapi/operations/admin_api/list_groups.go b/restapi/operations/admin_api/list_groups.go index 641cca480..52162663d 100644 --- a/restapi/operations/admin_api/list_groups.go +++ b/restapi/operations/admin_api/list_groups.go @@ -48,7 +48,7 @@ func NewListGroups(ctx *middleware.Context, handler ListGroupsHandler) *ListGrou return &ListGroups{Context: ctx, Handler: handler} } -/*ListGroups swagger:route GET /groups AdminAPI listGroups +/* ListGroups swagger:route GET /groups AdminAPI listGroups List Groups @@ -61,17 +61,16 @@ type ListGroups struct { func (o *ListGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListGroupsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/list_groups_parameters.go b/restapi/operations/admin_api/list_groups_parameters.go index ff0976b60..7387e580e 100644 --- a/restapi/operations/admin_api/list_groups_parameters.go +++ b/restapi/operations/admin_api/list_groups_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListGroupsParams creates a new ListGroupsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListGroupsParams() ListGroupsParams { return ListGroupsParams{} @@ -78,7 +79,6 @@ func (o *ListGroupsParams) BindRequest(r *http.Request, route *middleware.Matche if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -94,6 +94,7 @@ func (o *ListGroupsParams) bindLimit(rawData []string, hasKey bool, formats strf // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -116,6 +117,7 @@ func (o *ListGroupsParams) bindOffset(rawData []string, hasKey bool, formats str // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } diff --git a/restapi/operations/admin_api/list_p_v_cs.go b/restapi/operations/admin_api/list_p_v_cs.go index d8bdeff70..7fd86761a 100644 --- a/restapi/operations/admin_api/list_p_v_cs.go +++ b/restapi/operations/admin_api/list_p_v_cs.go @@ -48,7 +48,7 @@ func NewListPVCs(ctx *middleware.Context, handler ListPVCsHandler) *ListPVCs { return &ListPVCs{Context: ctx, Handler: handler} } -/*ListPVCs swagger:route GET /list-pvcs AdminAPI listPVCs +/* ListPVCs swagger:route GET /list-pvcs AdminAPI listPVCs List all PVCs from namespaces that the user has access to @@ -61,17 +61,16 @@ type ListPVCs struct { func (o *ListPVCs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListPVCsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListPVCs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/list_p_v_cs_parameters.go b/restapi/operations/admin_api/list_p_v_cs_parameters.go index fb3245a3e..9088da7fc 100644 --- a/restapi/operations/admin_api/list_p_v_cs_parameters.go +++ b/restapi/operations/admin_api/list_p_v_cs_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewListPVCsParams creates a new ListPVCsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListPVCsParams() ListPVCsParams { return ListPVCsParams{} diff --git a/restapi/operations/admin_api/list_policies.go b/restapi/operations/admin_api/list_policies.go index 10426d427..8d31865e0 100644 --- a/restapi/operations/admin_api/list_policies.go +++ b/restapi/operations/admin_api/list_policies.go @@ -48,7 +48,7 @@ func NewListPolicies(ctx *middleware.Context, handler ListPoliciesHandler) *List return &ListPolicies{Context: ctx, Handler: handler} } -/*ListPolicies swagger:route GET /policies AdminAPI listPolicies +/* ListPolicies swagger:route GET /policies AdminAPI listPolicies List Policies @@ -61,17 +61,16 @@ type ListPolicies struct { func (o *ListPolicies) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListPoliciesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListPolicies) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/list_policies_parameters.go b/restapi/operations/admin_api/list_policies_parameters.go index 974609b7a..8a6653d4d 100644 --- a/restapi/operations/admin_api/list_policies_parameters.go +++ b/restapi/operations/admin_api/list_policies_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListPoliciesParams creates a new ListPoliciesParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListPoliciesParams() ListPoliciesParams { return ListPoliciesParams{} @@ -78,7 +79,6 @@ func (o *ListPoliciesParams) BindRequest(r *http.Request, route *middleware.Matc if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -94,6 +94,7 @@ func (o *ListPoliciesParams) bindLimit(rawData []string, hasKey bool, formats st // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -116,6 +117,7 @@ func (o *ListPoliciesParams) bindOffset(rawData []string, hasKey bool, formats s // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } diff --git a/restapi/operations/admin_api/list_policies_with_bucket.go b/restapi/operations/admin_api/list_policies_with_bucket.go index 21eb74dc6..3e29bb7f3 100644 --- a/restapi/operations/admin_api/list_policies_with_bucket.go +++ b/restapi/operations/admin_api/list_policies_with_bucket.go @@ -48,7 +48,7 @@ func NewListPoliciesWithBucket(ctx *middleware.Context, handler ListPoliciesWith return &ListPoliciesWithBucket{Context: ctx, Handler: handler} } -/*ListPoliciesWithBucket swagger:route GET /bucket-policy/{bucket} AdminAPI listPoliciesWithBucket +/* ListPoliciesWithBucket swagger:route GET /bucket-policy/{bucket} AdminAPI listPoliciesWithBucket List Policies With Given Bucket @@ -61,17 +61,16 @@ type ListPoliciesWithBucket struct { func (o *ListPoliciesWithBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListPoliciesWithBucketParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListPoliciesWithBucket) ServeHTTP(rw http.ResponseWriter, r *http.Reque } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/list_policies_with_bucket_parameters.go b/restapi/operations/admin_api/list_policies_with_bucket_parameters.go index 7b94a244c..e4339da4d 100644 --- a/restapi/operations/admin_api/list_policies_with_bucket_parameters.go +++ b/restapi/operations/admin_api/list_policies_with_bucket_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListPoliciesWithBucketParams creates a new ListPoliciesWithBucketParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListPoliciesWithBucketParams() ListPoliciesWithBucketParams { return ListPoliciesWithBucketParams{} @@ -88,7 +89,6 @@ func (o *ListPoliciesWithBucketParams) BindRequest(r *http.Request, route *middl if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -104,7 +104,6 @@ func (o *ListPoliciesWithBucketParams) bindBucket(rawData []string, hasKey bool, // Required: true // Parameter is provided by construction from the route - o.Bucket = raw return nil @@ -119,6 +118,7 @@ func (o *ListPoliciesWithBucketParams) bindLimit(rawData []string, hasKey bool, // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -141,6 +141,7 @@ func (o *ListPoliciesWithBucketParams) bindOffset(rawData []string, hasKey bool, // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } diff --git a/restapi/operations/admin_api/list_tenants.go b/restapi/operations/admin_api/list_tenants.go index 42c25fd6a..7a830a941 100644 --- a/restapi/operations/admin_api/list_tenants.go +++ b/restapi/operations/admin_api/list_tenants.go @@ -48,7 +48,7 @@ func NewListTenants(ctx *middleware.Context, handler ListTenantsHandler) *ListTe return &ListTenants{Context: ctx, Handler: handler} } -/*ListTenants swagger:route GET /namespaces/{namespace}/tenants AdminAPI listTenants +/* ListTenants swagger:route GET /namespaces/{namespace}/tenants AdminAPI listTenants List Tenants by Namespace @@ -61,17 +61,16 @@ type ListTenants struct { func (o *ListTenants) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListTenantsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListTenants) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/list_tenants_parameters.go b/restapi/operations/admin_api/list_tenants_parameters.go index 53fa854d6..45d451c5f 100644 --- a/restapi/operations/admin_api/list_tenants_parameters.go +++ b/restapi/operations/admin_api/list_tenants_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListTenantsParams creates a new ListTenantsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListTenantsParams() ListTenantsParams { return ListTenantsParams{} @@ -97,7 +98,6 @@ func (o *ListTenantsParams) BindRequest(r *http.Request, route *middleware.Match if err := o.bindSortBy(qSortBy, qhkSortBy, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,6 +113,7 @@ func (o *ListTenantsParams) bindLimit(rawData []string, hasKey bool, formats str // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -135,7 +136,6 @@ func (o *ListTenantsParams) bindNamespace(rawData []string, hasKey bool, formats // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -150,6 +150,7 @@ func (o *ListTenantsParams) bindOffset(rawData []string, hasKey bool, formats st // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -172,10 +173,10 @@ func (o *ListTenantsParams) bindSortBy(rawData []string, hasKey bool, formats st // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.SortBy = &raw return nil diff --git a/restapi/operations/admin_api/list_users.go b/restapi/operations/admin_api/list_users.go index 2bec882fa..c101369e9 100644 --- a/restapi/operations/admin_api/list_users.go +++ b/restapi/operations/admin_api/list_users.go @@ -48,7 +48,7 @@ func NewListUsers(ctx *middleware.Context, handler ListUsersHandler) *ListUsers return &ListUsers{Context: ctx, Handler: handler} } -/*ListUsers swagger:route GET /users AdminAPI listUsers +/* ListUsers swagger:route GET /users AdminAPI listUsers List Users @@ -61,17 +61,16 @@ type ListUsers struct { func (o *ListUsers) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListUsersParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListUsers) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/list_users_for_policy.go b/restapi/operations/admin_api/list_users_for_policy.go index 77df7755b..61b236d7c 100644 --- a/restapi/operations/admin_api/list_users_for_policy.go +++ b/restapi/operations/admin_api/list_users_for_policy.go @@ -48,7 +48,7 @@ func NewListUsersForPolicy(ctx *middleware.Context, handler ListUsersForPolicyHa return &ListUsersForPolicy{Context: ctx, Handler: handler} } -/*ListUsersForPolicy swagger:route GET /policies/{policy}/users AdminAPI listUsersForPolicy +/* ListUsersForPolicy swagger:route GET /policies/{policy}/users AdminAPI listUsersForPolicy List Users for a Policy @@ -61,17 +61,16 @@ type ListUsersForPolicy struct { func (o *ListUsersForPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListUsersForPolicyParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListUsersForPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/list_users_for_policy_parameters.go b/restapi/operations/admin_api/list_users_for_policy_parameters.go index 77e5c692d..942a7c9c4 100644 --- a/restapi/operations/admin_api/list_users_for_policy_parameters.go +++ b/restapi/operations/admin_api/list_users_for_policy_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewListUsersForPolicyParams creates a new ListUsersForPolicyParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListUsersForPolicyParams() ListUsersForPolicyParams { return ListUsersForPolicyParams{} @@ -66,7 +67,6 @@ func (o *ListUsersForPolicyParams) BindRequest(r *http.Request, route *middlewar if err := o.bindPolicy(rPolicy, rhkPolicy, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *ListUsersForPolicyParams) bindPolicy(rawData []string, hasKey bool, for // Required: true // Parameter is provided by construction from the route - o.Policy = raw return nil diff --git a/restapi/operations/admin_api/list_users_parameters.go b/restapi/operations/admin_api/list_users_parameters.go index 58f491044..02b41fd7e 100644 --- a/restapi/operations/admin_api/list_users_parameters.go +++ b/restapi/operations/admin_api/list_users_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListUsersParams creates a new ListUsersParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListUsersParams() ListUsersParams { return ListUsersParams{} @@ -78,7 +79,6 @@ func (o *ListUsersParams) BindRequest(r *http.Request, route *middleware.Matched if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -94,6 +94,7 @@ func (o *ListUsersParams) bindLimit(rawData []string, hasKey bool, formats strfm // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -116,6 +117,7 @@ func (o *ListUsersParams) bindOffset(rawData []string, hasKey bool, formats strf // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } diff --git a/restapi/operations/admin_api/list_users_with_access_to_bucket.go b/restapi/operations/admin_api/list_users_with_access_to_bucket.go index dbe7d7b77..f6b5d1cac 100644 --- a/restapi/operations/admin_api/list_users_with_access_to_bucket.go +++ b/restapi/operations/admin_api/list_users_with_access_to_bucket.go @@ -48,7 +48,7 @@ func NewListUsersWithAccessToBucket(ctx *middleware.Context, handler ListUsersWi return &ListUsersWithAccessToBucket{Context: ctx, Handler: handler} } -/*ListUsersWithAccessToBucket swagger:route GET /bucket-users/{bucket} AdminAPI listUsersWithAccessToBucket +/* ListUsersWithAccessToBucket swagger:route GET /bucket-users/{bucket} AdminAPI listUsersWithAccessToBucket List Users With Access to a Given Bucket @@ -61,17 +61,16 @@ type ListUsersWithAccessToBucket struct { func (o *ListUsersWithAccessToBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListUsersWithAccessToBucketParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListUsersWithAccessToBucket) ServeHTTP(rw http.ResponseWriter, r *http. } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/list_users_with_access_to_bucket_parameters.go b/restapi/operations/admin_api/list_users_with_access_to_bucket_parameters.go index a33395ced..3c227d1ea 100644 --- a/restapi/operations/admin_api/list_users_with_access_to_bucket_parameters.go +++ b/restapi/operations/admin_api/list_users_with_access_to_bucket_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListUsersWithAccessToBucketParams creates a new ListUsersWithAccessToBucketParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListUsersWithAccessToBucketParams() ListUsersWithAccessToBucketParams { return ListUsersWithAccessToBucketParams{} @@ -88,7 +89,6 @@ func (o *ListUsersWithAccessToBucketParams) BindRequest(r *http.Request, route * if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -104,7 +104,6 @@ func (o *ListUsersWithAccessToBucketParams) bindBucket(rawData []string, hasKey // Required: true // Parameter is provided by construction from the route - o.Bucket = raw return nil @@ -119,6 +118,7 @@ func (o *ListUsersWithAccessToBucketParams) bindLimit(rawData []string, hasKey b // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -141,6 +141,7 @@ func (o *ListUsersWithAccessToBucketParams) bindOffset(rawData []string, hasKey // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } diff --git a/restapi/operations/admin_api/notification_endpoint_list.go b/restapi/operations/admin_api/notification_endpoint_list.go index 936013130..c6569745c 100644 --- a/restapi/operations/admin_api/notification_endpoint_list.go +++ b/restapi/operations/admin_api/notification_endpoint_list.go @@ -48,7 +48,7 @@ func NewNotificationEndpointList(ctx *middleware.Context, handler NotificationEn return &NotificationEndpointList{Context: ctx, Handler: handler} } -/*NotificationEndpointList swagger:route GET /admin/notification_endpoints AdminAPI notificationEndpointList +/* NotificationEndpointList swagger:route GET /admin/notification_endpoints AdminAPI notificationEndpointList Returns a list of active notification endpoints @@ -61,17 +61,16 @@ type NotificationEndpointList struct { func (o *NotificationEndpointList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewNotificationEndpointListParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *NotificationEndpointList) ServeHTTP(rw http.ResponseWriter, r *http.Req } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/notification_endpoint_list_parameters.go b/restapi/operations/admin_api/notification_endpoint_list_parameters.go index b335ba90c..bdbc6d412 100644 --- a/restapi/operations/admin_api/notification_endpoint_list_parameters.go +++ b/restapi/operations/admin_api/notification_endpoint_list_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewNotificationEndpointListParams creates a new NotificationEndpointListParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewNotificationEndpointListParams() NotificationEndpointListParams { return NotificationEndpointListParams{} diff --git a/restapi/operations/admin_api/policy_info.go b/restapi/operations/admin_api/policy_info.go index 686ff4ee5..f8af8df6f 100644 --- a/restapi/operations/admin_api/policy_info.go +++ b/restapi/operations/admin_api/policy_info.go @@ -48,7 +48,7 @@ func NewPolicyInfo(ctx *middleware.Context, handler PolicyInfoHandler) *PolicyIn return &PolicyInfo{Context: ctx, Handler: handler} } -/*PolicyInfo swagger:route GET /policy AdminAPI policyInfo +/* PolicyInfo swagger:route GET /policy AdminAPI policyInfo Policy info @@ -61,17 +61,16 @@ type PolicyInfo struct { func (o *PolicyInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewPolicyInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *PolicyInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/policy_info_parameters.go b/restapi/operations/admin_api/policy_info_parameters.go index 92e6fa21a..cc2479a2a 100644 --- a/restapi/operations/admin_api/policy_info_parameters.go +++ b/restapi/operations/admin_api/policy_info_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewPolicyInfoParams creates a new PolicyInfoParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewPolicyInfoParams() PolicyInfoParams { return PolicyInfoParams{} @@ -70,7 +71,6 @@ func (o *PolicyInfoParams) BindRequest(r *http.Request, route *middleware.Matche if err := o.bindName(qName, qhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -89,10 +89,10 @@ func (o *PolicyInfoParams) bindName(rawData []string, hasKey bool, formats strfm // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("name", "query", raw); err != nil { return err } - o.Name = raw return nil diff --git a/restapi/operations/admin_api/profiling_start.go b/restapi/operations/admin_api/profiling_start.go index 8a4d0af65..290d20d8e 100644 --- a/restapi/operations/admin_api/profiling_start.go +++ b/restapi/operations/admin_api/profiling_start.go @@ -48,7 +48,7 @@ func NewProfilingStart(ctx *middleware.Context, handler ProfilingStartHandler) * return &ProfilingStart{Context: ctx, Handler: handler} } -/*ProfilingStart swagger:route POST /profiling/start AdminAPI profilingStart +/* ProfilingStart swagger:route POST /profiling/start AdminAPI profilingStart Start recording profile data @@ -61,17 +61,16 @@ type ProfilingStart struct { func (o *ProfilingStart) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewProfilingStartParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ProfilingStart) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/profiling_start_parameters.go b/restapi/operations/admin_api/profiling_start_parameters.go index 48244e029..933d7a4fe 100644 --- a/restapi/operations/admin_api/profiling_start_parameters.go +++ b/restapi/operations/admin_api/profiling_start_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewProfilingStartParams creates a new ProfilingStartParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewProfilingStartParams() ProfilingStartParams { return ProfilingStartParams{} @@ -80,6 +83,11 @@ func (o *ProfilingStartParams) BindRequest(r *http.Request, route *middleware.Ma res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/admin_api/profiling_stop.go b/restapi/operations/admin_api/profiling_stop.go index 8800be99a..fee94c038 100644 --- a/restapi/operations/admin_api/profiling_stop.go +++ b/restapi/operations/admin_api/profiling_stop.go @@ -48,7 +48,7 @@ func NewProfilingStop(ctx *middleware.Context, handler ProfilingStopHandler) *Pr return &ProfilingStop{Context: ctx, Handler: handler} } -/*ProfilingStop swagger:route POST /profiling/stop AdminAPI profilingStop +/* ProfilingStop swagger:route POST /profiling/stop AdminAPI profilingStop Stop and download profile data @@ -61,17 +61,16 @@ type ProfilingStop struct { func (o *ProfilingStop) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewProfilingStopParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ProfilingStop) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/profiling_stop_parameters.go b/restapi/operations/admin_api/profiling_stop_parameters.go index a131d9066..3ee28083a 100644 --- a/restapi/operations/admin_api/profiling_stop_parameters.go +++ b/restapi/operations/admin_api/profiling_stop_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewProfilingStopParams creates a new ProfilingStopParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewProfilingStopParams() ProfilingStopParams { return ProfilingStopParams{} diff --git a/restapi/operations/admin_api/put_tenant_y_a_m_l.go b/restapi/operations/admin_api/put_tenant_y_a_m_l.go index 7160e5375..eb47f9670 100644 --- a/restapi/operations/admin_api/put_tenant_y_a_m_l.go +++ b/restapi/operations/admin_api/put_tenant_y_a_m_l.go @@ -48,7 +48,7 @@ func NewPutTenantYAML(ctx *middleware.Context, handler PutTenantYAMLHandler) *Pu return &PutTenantYAML{Context: ctx, Handler: handler} } -/*PutTenantYAML swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/yaml AdminAPI putTenantYAML +/* PutTenantYAML swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/yaml AdminAPI putTenantYAML Put the Tenant YAML @@ -61,17 +61,16 @@ type PutTenantYAML struct { func (o *PutTenantYAML) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewPutTenantYAMLParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *PutTenantYAML) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/put_tenant_y_a_m_l_parameters.go b/restapi/operations/admin_api/put_tenant_y_a_m_l_parameters.go index 316975eee..37d13180f 100644 --- a/restapi/operations/admin_api/put_tenant_y_a_m_l_parameters.go +++ b/restapi/operations/admin_api/put_tenant_y_a_m_l_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewPutTenantYAMLParams creates a new PutTenantYAMLParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewPutTenantYAMLParams() PutTenantYAMLParams { return PutTenantYAMLParams{} @@ -91,6 +94,11 @@ func (o *PutTenantYAMLParams) BindRequest(r *http.Request, route *middleware.Mat res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -98,6 +106,7 @@ func (o *PutTenantYAMLParams) BindRequest(r *http.Request, route *middleware.Mat } else { res = append(res, errors.Required("body", "body", "")) } + rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { res = append(res, err) @@ -107,7 +116,6 @@ func (o *PutTenantYAMLParams) BindRequest(r *http.Request, route *middleware.Mat if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -123,7 +131,6 @@ func (o *PutTenantYAMLParams) bindNamespace(rawData []string, hasKey bool, forma // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -138,7 +145,6 @@ func (o *PutTenantYAMLParams) bindTenant(rawData []string, hasKey bool, formats // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/remove_group.go b/restapi/operations/admin_api/remove_group.go index c302b5fb3..08a5efe26 100644 --- a/restapi/operations/admin_api/remove_group.go +++ b/restapi/operations/admin_api/remove_group.go @@ -48,7 +48,7 @@ func NewRemoveGroup(ctx *middleware.Context, handler RemoveGroupHandler) *Remove return &RemoveGroup{Context: ctx, Handler: handler} } -/*RemoveGroup swagger:route DELETE /groups/{name} AdminAPI removeGroup +/* RemoveGroup swagger:route DELETE /groups/{name} AdminAPI removeGroup Remove group @@ -61,17 +61,16 @@ type RemoveGroup struct { func (o *RemoveGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewRemoveGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *RemoveGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/remove_group_parameters.go b/restapi/operations/admin_api/remove_group_parameters.go index 3c02a240b..c3eec79dc 100644 --- a/restapi/operations/admin_api/remove_group_parameters.go +++ b/restapi/operations/admin_api/remove_group_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewRemoveGroupParams creates a new RemoveGroupParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewRemoveGroupParams() RemoveGroupParams { return RemoveGroupParams{} @@ -66,7 +67,6 @@ func (o *RemoveGroupParams) BindRequest(r *http.Request, route *middleware.Match if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *RemoveGroupParams) bindName(rawData []string, hasKey bool, formats strf // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/admin_api/remove_policy.go b/restapi/operations/admin_api/remove_policy.go index 1efe44c8f..9f7ec789d 100644 --- a/restapi/operations/admin_api/remove_policy.go +++ b/restapi/operations/admin_api/remove_policy.go @@ -48,7 +48,7 @@ func NewRemovePolicy(ctx *middleware.Context, handler RemovePolicyHandler) *Remo return &RemovePolicy{Context: ctx, Handler: handler} } -/*RemovePolicy swagger:route DELETE /policy AdminAPI removePolicy +/* RemovePolicy swagger:route DELETE /policy AdminAPI removePolicy Remove policy @@ -61,17 +61,16 @@ type RemovePolicy struct { func (o *RemovePolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewRemovePolicyParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *RemovePolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/remove_policy_parameters.go b/restapi/operations/admin_api/remove_policy_parameters.go index 5cbc7de48..e2675bc3a 100644 --- a/restapi/operations/admin_api/remove_policy_parameters.go +++ b/restapi/operations/admin_api/remove_policy_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewRemovePolicyParams creates a new RemovePolicyParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewRemovePolicyParams() RemovePolicyParams { return RemovePolicyParams{} @@ -70,7 +71,6 @@ func (o *RemovePolicyParams) BindRequest(r *http.Request, route *middleware.Matc if err := o.bindName(qName, qhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -89,10 +89,10 @@ func (o *RemovePolicyParams) bindName(rawData []string, hasKey bool, formats str // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("name", "query", raw); err != nil { return err } - o.Name = raw return nil diff --git a/restapi/operations/admin_api/remove_user.go b/restapi/operations/admin_api/remove_user.go index e5e3db2e7..d6a9a50df 100644 --- a/restapi/operations/admin_api/remove_user.go +++ b/restapi/operations/admin_api/remove_user.go @@ -48,7 +48,7 @@ func NewRemoveUser(ctx *middleware.Context, handler RemoveUserHandler) *RemoveUs return &RemoveUser{Context: ctx, Handler: handler} } -/*RemoveUser swagger:route DELETE /users/{name} AdminAPI removeUser +/* RemoveUser swagger:route DELETE /users/{name} AdminAPI removeUser Remove user @@ -61,17 +61,16 @@ type RemoveUser struct { func (o *RemoveUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewRemoveUserParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *RemoveUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/remove_user_parameters.go b/restapi/operations/admin_api/remove_user_parameters.go index de79ca6e0..823bb5eb3 100644 --- a/restapi/operations/admin_api/remove_user_parameters.go +++ b/restapi/operations/admin_api/remove_user_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewRemoveUserParams creates a new RemoveUserParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewRemoveUserParams() RemoveUserParams { return RemoveUserParams{} @@ -66,7 +67,6 @@ func (o *RemoveUserParams) BindRequest(r *http.Request, route *middleware.Matche if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *RemoveUserParams) bindName(rawData []string, hasKey bool, formats strfm // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/admin_api/restart_service.go b/restapi/operations/admin_api/restart_service.go index 1c44a2a1d..3feb1a982 100644 --- a/restapi/operations/admin_api/restart_service.go +++ b/restapi/operations/admin_api/restart_service.go @@ -48,7 +48,7 @@ func NewRestartService(ctx *middleware.Context, handler RestartServiceHandler) * return &RestartService{Context: ctx, Handler: handler} } -/*RestartService swagger:route POST /service/restart AdminAPI restartService +/* RestartService swagger:route POST /service/restart AdminAPI restartService Restart Service @@ -61,17 +61,16 @@ type RestartService struct { func (o *RestartService) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewRestartServiceParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *RestartService) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/restart_service_parameters.go b/restapi/operations/admin_api/restart_service_parameters.go index 780ed9da5..40c9c5f2e 100644 --- a/restapi/operations/admin_api/restart_service_parameters.go +++ b/restapi/operations/admin_api/restart_service_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewRestartServiceParams creates a new RestartServiceParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewRestartServiceParams() RestartServiceParams { return RestartServiceParams{} diff --git a/restapi/operations/admin_api/set_config.go b/restapi/operations/admin_api/set_config.go index ca2f031ac..cb895255b 100644 --- a/restapi/operations/admin_api/set_config.go +++ b/restapi/operations/admin_api/set_config.go @@ -48,7 +48,7 @@ func NewSetConfig(ctx *middleware.Context, handler SetConfigHandler) *SetConfig return &SetConfig{Context: ctx, Handler: handler} } -/*SetConfig swagger:route PUT /configs/{name} AdminAPI setConfig +/* SetConfig swagger:route PUT /configs/{name} AdminAPI setConfig Set Configuration @@ -61,17 +61,16 @@ type SetConfig struct { func (o *SetConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSetConfigParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SetConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/set_config_parameters.go b/restapi/operations/admin_api/set_config_parameters.go index 17ed4545c..1d85b85b6 100644 --- a/restapi/operations/admin_api/set_config_parameters.go +++ b/restapi/operations/admin_api/set_config_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewSetConfigParams creates a new SetConfigParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSetConfigParams() SetConfigParams { return SetConfigParams{} @@ -86,6 +89,11 @@ func (o *SetConfigParams) BindRequest(r *http.Request, route *middleware.Matched res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *SetConfigParams) BindRequest(r *http.Request, route *middleware.Matched } else { res = append(res, errors.Required("body", "body", "")) } + rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *SetConfigParams) bindName(rawData []string, hasKey bool, formats strfmt // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/admin_api/set_policy.go b/restapi/operations/admin_api/set_policy.go index 503edf0c8..8b80c0b5f 100644 --- a/restapi/operations/admin_api/set_policy.go +++ b/restapi/operations/admin_api/set_policy.go @@ -48,7 +48,7 @@ func NewSetPolicy(ctx *middleware.Context, handler SetPolicyHandler) *SetPolicy return &SetPolicy{Context: ctx, Handler: handler} } -/*SetPolicy swagger:route PUT /set-policy/{name} AdminAPI setPolicy +/* SetPolicy swagger:route PUT /set-policy/{name} AdminAPI setPolicy Set policy @@ -61,17 +61,16 @@ type SetPolicy struct { func (o *SetPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSetPolicyParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SetPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/set_policy_multiple.go b/restapi/operations/admin_api/set_policy_multiple.go index 4b1647c5f..ef8886627 100644 --- a/restapi/operations/admin_api/set_policy_multiple.go +++ b/restapi/operations/admin_api/set_policy_multiple.go @@ -48,7 +48,7 @@ func NewSetPolicyMultiple(ctx *middleware.Context, handler SetPolicyMultipleHand return &SetPolicyMultiple{Context: ctx, Handler: handler} } -/*SetPolicyMultiple swagger:route PUT /set-policy-multi/{name} AdminAPI setPolicyMultiple +/* SetPolicyMultiple swagger:route PUT /set-policy-multi/{name} AdminAPI setPolicyMultiple Set policy to multiple users/groups @@ -61,17 +61,16 @@ type SetPolicyMultiple struct { func (o *SetPolicyMultiple) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSetPolicyMultipleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SetPolicyMultiple) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/set_policy_multiple_parameters.go b/restapi/operations/admin_api/set_policy_multiple_parameters.go index af110933b..f28003f64 100644 --- a/restapi/operations/admin_api/set_policy_multiple_parameters.go +++ b/restapi/operations/admin_api/set_policy_multiple_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewSetPolicyMultipleParams creates a new SetPolicyMultipleParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSetPolicyMultipleParams() SetPolicyMultipleParams { return SetPolicyMultipleParams{} @@ -86,6 +89,11 @@ func (o *SetPolicyMultipleParams) BindRequest(r *http.Request, route *middleware res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *SetPolicyMultipleParams) BindRequest(r *http.Request, route *middleware } else { res = append(res, errors.Required("body", "body", "")) } + rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *SetPolicyMultipleParams) bindName(rawData []string, hasKey bool, format // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/admin_api/set_policy_parameters.go b/restapi/operations/admin_api/set_policy_parameters.go index f024aebd3..343d10808 100644 --- a/restapi/operations/admin_api/set_policy_parameters.go +++ b/restapi/operations/admin_api/set_policy_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewSetPolicyParams creates a new SetPolicyParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSetPolicyParams() SetPolicyParams { return SetPolicyParams{} @@ -86,6 +89,11 @@ func (o *SetPolicyParams) BindRequest(r *http.Request, route *middleware.Matched res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *SetPolicyParams) BindRequest(r *http.Request, route *middleware.Matched } else { res = append(res, errors.Required("body", "body", "")) } + rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *SetPolicyParams) bindName(rawData []string, hasKey bool, formats strfmt // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/admin_api/subscription_activate.go b/restapi/operations/admin_api/subscription_activate.go index 4a7b66cf7..7e6e36fd2 100644 --- a/restapi/operations/admin_api/subscription_activate.go +++ b/restapi/operations/admin_api/subscription_activate.go @@ -48,7 +48,7 @@ func NewSubscriptionActivate(ctx *middleware.Context, handler SubscriptionActiva return &SubscriptionActivate{Context: ctx, Handler: handler} } -/*SubscriptionActivate swagger:route POST /subscription/namespaces/{namespace}/tenants/{tenant}/activate AdminAPI subscriptionActivate +/* SubscriptionActivate swagger:route POST /subscription/namespaces/{namespace}/tenants/{tenant}/activate AdminAPI subscriptionActivate Activate a particular tenant using the existing subscription license @@ -61,17 +61,16 @@ type SubscriptionActivate struct { func (o *SubscriptionActivate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSubscriptionActivateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SubscriptionActivate) ServeHTTP(rw http.ResponseWriter, r *http.Request } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/subscription_activate_parameters.go b/restapi/operations/admin_api/subscription_activate_parameters.go index cbb33d2eb..cacd72512 100644 --- a/restapi/operations/admin_api/subscription_activate_parameters.go +++ b/restapi/operations/admin_api/subscription_activate_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewSubscriptionActivateParams creates a new SubscriptionActivateParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSubscriptionActivateParams() SubscriptionActivateParams { return SubscriptionActivateParams{} @@ -76,7 +77,6 @@ func (o *SubscriptionActivateParams) BindRequest(r *http.Request, route *middlew if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -92,7 +92,6 @@ func (o *SubscriptionActivateParams) bindNamespace(rawData []string, hasKey bool // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -107,7 +106,6 @@ func (o *SubscriptionActivateParams) bindTenant(rawData []string, hasKey bool, f // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/subscription_info.go b/restapi/operations/admin_api/subscription_info.go index 2bd575954..923161f74 100644 --- a/restapi/operations/admin_api/subscription_info.go +++ b/restapi/operations/admin_api/subscription_info.go @@ -48,7 +48,7 @@ func NewSubscriptionInfo(ctx *middleware.Context, handler SubscriptionInfoHandle return &SubscriptionInfo{Context: ctx, Handler: handler} } -/*SubscriptionInfo swagger:route GET /subscription/info AdminAPI subscriptionInfo +/* SubscriptionInfo swagger:route GET /subscription/info AdminAPI subscriptionInfo Subscription info @@ -61,17 +61,16 @@ type SubscriptionInfo struct { func (o *SubscriptionInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSubscriptionInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SubscriptionInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/subscription_info_parameters.go b/restapi/operations/admin_api/subscription_info_parameters.go index 1856aa357..042842026 100644 --- a/restapi/operations/admin_api/subscription_info_parameters.go +++ b/restapi/operations/admin_api/subscription_info_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewSubscriptionInfoParams creates a new SubscriptionInfoParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSubscriptionInfoParams() SubscriptionInfoParams { return SubscriptionInfoParams{} diff --git a/restapi/operations/admin_api/subscription_refresh.go b/restapi/operations/admin_api/subscription_refresh.go index 84bb0f120..43340f5a1 100644 --- a/restapi/operations/admin_api/subscription_refresh.go +++ b/restapi/operations/admin_api/subscription_refresh.go @@ -48,7 +48,7 @@ func NewSubscriptionRefresh(ctx *middleware.Context, handler SubscriptionRefresh return &SubscriptionRefresh{Context: ctx, Handler: handler} } -/*SubscriptionRefresh swagger:route POST /subscription/refresh AdminAPI subscriptionRefresh +/* SubscriptionRefresh swagger:route POST /subscription/refresh AdminAPI subscriptionRefresh Refresh existing subscription license @@ -61,17 +61,16 @@ type SubscriptionRefresh struct { func (o *SubscriptionRefresh) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSubscriptionRefreshParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SubscriptionRefresh) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/subscription_refresh_parameters.go b/restapi/operations/admin_api/subscription_refresh_parameters.go index bd6cd515b..4ff865ac7 100644 --- a/restapi/operations/admin_api/subscription_refresh_parameters.go +++ b/restapi/operations/admin_api/subscription_refresh_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewSubscriptionRefreshParams creates a new SubscriptionRefreshParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSubscriptionRefreshParams() SubscriptionRefreshParams { return SubscriptionRefreshParams{} diff --git a/restapi/operations/admin_api/subscription_validate.go b/restapi/operations/admin_api/subscription_validate.go index b70050e9a..9dcdd5de4 100644 --- a/restapi/operations/admin_api/subscription_validate.go +++ b/restapi/operations/admin_api/subscription_validate.go @@ -48,7 +48,7 @@ func NewSubscriptionValidate(ctx *middleware.Context, handler SubscriptionValida return &SubscriptionValidate{Context: ctx, Handler: handler} } -/*SubscriptionValidate swagger:route POST /subscription/validate AdminAPI subscriptionValidate +/* SubscriptionValidate swagger:route POST /subscription/validate AdminAPI subscriptionValidate Validates subscription license @@ -61,17 +61,16 @@ type SubscriptionValidate struct { func (o *SubscriptionValidate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSubscriptionValidateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SubscriptionValidate) ServeHTTP(rw http.ResponseWriter, r *http.Request } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/subscription_validate_parameters.go b/restapi/operations/admin_api/subscription_validate_parameters.go index 8ab9c29c6..1514ae60d 100644 --- a/restapi/operations/admin_api/subscription_validate_parameters.go +++ b/restapi/operations/admin_api/subscription_validate_parameters.go @@ -23,18 +23,21 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewSubscriptionValidateParams creates a new SubscriptionValidateParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSubscriptionValidateParams() SubscriptionValidateParams { return SubscriptionValidateParams{} @@ -80,6 +83,11 @@ func (o *SubscriptionValidateParams) BindRequest(r *http.Request, route *middlew res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/admin_api/tenant_add_pool.go b/restapi/operations/admin_api/tenant_add_pool.go index 42428012b..a5304a227 100644 --- a/restapi/operations/admin_api/tenant_add_pool.go +++ b/restapi/operations/admin_api/tenant_add_pool.go @@ -48,7 +48,7 @@ func NewTenantAddPool(ctx *middleware.Context, handler TenantAddPoolHandler) *Te return &TenantAddPool{Context: ctx, Handler: handler} } -/*TenantAddPool swagger:route POST /namespaces/{namespace}/tenants/{tenant}/pools AdminAPI tenantAddPool +/* TenantAddPool swagger:route POST /namespaces/{namespace}/tenants/{tenant}/pools AdminAPI tenantAddPool Tenant Add Pool @@ -61,17 +61,16 @@ type TenantAddPool struct { func (o *TenantAddPool) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewTenantAddPoolParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *TenantAddPool) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/tenant_add_pool_parameters.go b/restapi/operations/admin_api/tenant_add_pool_parameters.go index 08ced84f2..7a0cc457c 100644 --- a/restapi/operations/admin_api/tenant_add_pool_parameters.go +++ b/restapi/operations/admin_api/tenant_add_pool_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewTenantAddPoolParams creates a new TenantAddPoolParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewTenantAddPoolParams() TenantAddPoolParams { return TenantAddPoolParams{} @@ -91,6 +94,11 @@ func (o *TenantAddPoolParams) BindRequest(r *http.Request, route *middleware.Mat res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -98,6 +106,7 @@ func (o *TenantAddPoolParams) BindRequest(r *http.Request, route *middleware.Mat } else { res = append(res, errors.Required("body", "body", "")) } + rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { res = append(res, err) @@ -107,7 +116,6 @@ func (o *TenantAddPoolParams) BindRequest(r *http.Request, route *middleware.Mat if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -123,7 +131,6 @@ func (o *TenantAddPoolParams) bindNamespace(rawData []string, hasKey bool, forma // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -138,7 +145,6 @@ func (o *TenantAddPoolParams) bindTenant(rawData []string, hasKey bool, formats // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/tenant_info.go b/restapi/operations/admin_api/tenant_info.go index 41ea0a466..f67b472ae 100644 --- a/restapi/operations/admin_api/tenant_info.go +++ b/restapi/operations/admin_api/tenant_info.go @@ -48,7 +48,7 @@ func NewTenantInfo(ctx *middleware.Context, handler TenantInfoHandler) *TenantIn return &TenantInfo{Context: ctx, Handler: handler} } -/*TenantInfo swagger:route GET /namespaces/{namespace}/tenants/{tenant} AdminAPI tenantInfo +/* TenantInfo swagger:route GET /namespaces/{namespace}/tenants/{tenant} AdminAPI tenantInfo Tenant Info @@ -61,17 +61,16 @@ type TenantInfo struct { func (o *TenantInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewTenantInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *TenantInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/tenant_info_parameters.go b/restapi/operations/admin_api/tenant_info_parameters.go index 49e0cfa85..c49d3c4af 100644 --- a/restapi/operations/admin_api/tenant_info_parameters.go +++ b/restapi/operations/admin_api/tenant_info_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewTenantInfoParams creates a new TenantInfoParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewTenantInfoParams() TenantInfoParams { return TenantInfoParams{} @@ -76,7 +77,6 @@ func (o *TenantInfoParams) BindRequest(r *http.Request, route *middleware.Matche if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -92,7 +92,6 @@ func (o *TenantInfoParams) bindNamespace(rawData []string, hasKey bool, formats // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -107,7 +106,6 @@ func (o *TenantInfoParams) bindTenant(rawData []string, hasKey bool, formats str // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/tenant_update_certificate.go b/restapi/operations/admin_api/tenant_update_certificate.go index 96c70be05..080351c28 100644 --- a/restapi/operations/admin_api/tenant_update_certificate.go +++ b/restapi/operations/admin_api/tenant_update_certificate.go @@ -48,7 +48,7 @@ func NewTenantUpdateCertificate(ctx *middleware.Context, handler TenantUpdateCer return &TenantUpdateCertificate{Context: ctx, Handler: handler} } -/*TenantUpdateCertificate swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/certificates AdminAPI tenantUpdateCertificate +/* TenantUpdateCertificate swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/certificates AdminAPI tenantUpdateCertificate Tenant Update Certificates @@ -61,17 +61,16 @@ type TenantUpdateCertificate struct { func (o *TenantUpdateCertificate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewTenantUpdateCertificateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *TenantUpdateCertificate) ServeHTTP(rw http.ResponseWriter, r *http.Requ } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/tenant_update_certificate_parameters.go b/restapi/operations/admin_api/tenant_update_certificate_parameters.go index f366ecef3..d9f892e5d 100644 --- a/restapi/operations/admin_api/tenant_update_certificate_parameters.go +++ b/restapi/operations/admin_api/tenant_update_certificate_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewTenantUpdateCertificateParams creates a new TenantUpdateCertificateParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewTenantUpdateCertificateParams() TenantUpdateCertificateParams { return TenantUpdateCertificateParams{} @@ -91,6 +94,11 @@ func (o *TenantUpdateCertificateParams) BindRequest(r *http.Request, route *midd res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -98,6 +106,7 @@ func (o *TenantUpdateCertificateParams) BindRequest(r *http.Request, route *midd } else { res = append(res, errors.Required("body", "body", "")) } + rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { res = append(res, err) @@ -107,7 +116,6 @@ func (o *TenantUpdateCertificateParams) BindRequest(r *http.Request, route *midd if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -123,7 +131,6 @@ func (o *TenantUpdateCertificateParams) bindNamespace(rawData []string, hasKey b // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -138,7 +145,6 @@ func (o *TenantUpdateCertificateParams) bindTenant(rawData []string, hasKey bool // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/tenant_update_encryption.go b/restapi/operations/admin_api/tenant_update_encryption.go index 8ec74012e..f823a136b 100644 --- a/restapi/operations/admin_api/tenant_update_encryption.go +++ b/restapi/operations/admin_api/tenant_update_encryption.go @@ -48,7 +48,7 @@ func NewTenantUpdateEncryption(ctx *middleware.Context, handler TenantUpdateEncr return &TenantUpdateEncryption{Context: ctx, Handler: handler} } -/*TenantUpdateEncryption swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/encryption AdminAPI tenantUpdateEncryption +/* TenantUpdateEncryption swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/encryption AdminAPI tenantUpdateEncryption Tenant Update Encryption @@ -61,17 +61,16 @@ type TenantUpdateEncryption struct { func (o *TenantUpdateEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewTenantUpdateEncryptionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *TenantUpdateEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Reque } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/tenant_update_encryption_parameters.go b/restapi/operations/admin_api/tenant_update_encryption_parameters.go index ef3689396..175e5c909 100644 --- a/restapi/operations/admin_api/tenant_update_encryption_parameters.go +++ b/restapi/operations/admin_api/tenant_update_encryption_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewTenantUpdateEncryptionParams creates a new TenantUpdateEncryptionParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewTenantUpdateEncryptionParams() TenantUpdateEncryptionParams { return TenantUpdateEncryptionParams{} @@ -91,6 +94,11 @@ func (o *TenantUpdateEncryptionParams) BindRequest(r *http.Request, route *middl res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -98,6 +106,7 @@ func (o *TenantUpdateEncryptionParams) BindRequest(r *http.Request, route *middl } else { res = append(res, errors.Required("body", "body", "")) } + rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { res = append(res, err) @@ -107,7 +116,6 @@ func (o *TenantUpdateEncryptionParams) BindRequest(r *http.Request, route *middl if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -123,7 +131,6 @@ func (o *TenantUpdateEncryptionParams) bindNamespace(rawData []string, hasKey bo // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -138,7 +145,6 @@ func (o *TenantUpdateEncryptionParams) bindTenant(rawData []string, hasKey bool, // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/tenant_update_pools.go b/restapi/operations/admin_api/tenant_update_pools.go index a6237cbe9..b86876437 100644 --- a/restapi/operations/admin_api/tenant_update_pools.go +++ b/restapi/operations/admin_api/tenant_update_pools.go @@ -48,7 +48,7 @@ func NewTenantUpdatePools(ctx *middleware.Context, handler TenantUpdatePoolsHand return &TenantUpdatePools{Context: ctx, Handler: handler} } -/*TenantUpdatePools swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/pools AdminAPI tenantUpdatePools +/* TenantUpdatePools swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/pools AdminAPI tenantUpdatePools Tenant Update Pools @@ -61,17 +61,16 @@ type TenantUpdatePools struct { func (o *TenantUpdatePools) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewTenantUpdatePoolsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *TenantUpdatePools) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/tenant_update_pools_parameters.go b/restapi/operations/admin_api/tenant_update_pools_parameters.go index 2d39e921c..9a99f9a60 100644 --- a/restapi/operations/admin_api/tenant_update_pools_parameters.go +++ b/restapi/operations/admin_api/tenant_update_pools_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewTenantUpdatePoolsParams creates a new TenantUpdatePoolsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewTenantUpdatePoolsParams() TenantUpdatePoolsParams { return TenantUpdatePoolsParams{} @@ -91,6 +94,11 @@ func (o *TenantUpdatePoolsParams) BindRequest(r *http.Request, route *middleware res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -98,6 +106,7 @@ func (o *TenantUpdatePoolsParams) BindRequest(r *http.Request, route *middleware } else { res = append(res, errors.Required("body", "body", "")) } + rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { res = append(res, err) @@ -107,7 +116,6 @@ func (o *TenantUpdatePoolsParams) BindRequest(r *http.Request, route *middleware if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -123,7 +131,6 @@ func (o *TenantUpdatePoolsParams) bindNamespace(rawData []string, hasKey bool, f // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -138,7 +145,6 @@ func (o *TenantUpdatePoolsParams) bindTenant(rawData []string, hasKey bool, form // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/tiers_list.go b/restapi/operations/admin_api/tiers_list.go index 03af11ca0..db1d4ae9b 100644 --- a/restapi/operations/admin_api/tiers_list.go +++ b/restapi/operations/admin_api/tiers_list.go @@ -48,7 +48,7 @@ func NewTiersList(ctx *middleware.Context, handler TiersListHandler) *TiersList return &TiersList{Context: ctx, Handler: handler} } -/*TiersList swagger:route GET /admin/tiers AdminAPI tiersList +/* TiersList swagger:route GET /admin/tiers AdminAPI tiersList Returns a list of tiers for ilm @@ -61,17 +61,16 @@ type TiersList struct { func (o *TiersList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewTiersListParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *TiersList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/tiers_list_parameters.go b/restapi/operations/admin_api/tiers_list_parameters.go index 6373917b3..aeadeb6bf 100644 --- a/restapi/operations/admin_api/tiers_list_parameters.go +++ b/restapi/operations/admin_api/tiers_list_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewTiersListParams creates a new TiersListParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewTiersListParams() TiersListParams { return TiersListParams{} diff --git a/restapi/operations/admin_api/update_group.go b/restapi/operations/admin_api/update_group.go index c1c7156f8..37a913890 100644 --- a/restapi/operations/admin_api/update_group.go +++ b/restapi/operations/admin_api/update_group.go @@ -48,7 +48,7 @@ func NewUpdateGroup(ctx *middleware.Context, handler UpdateGroupHandler) *Update return &UpdateGroup{Context: ctx, Handler: handler} } -/*UpdateGroup swagger:route PUT /groups/{name} AdminAPI updateGroup +/* UpdateGroup swagger:route PUT /groups/{name} AdminAPI updateGroup Update Group Members or Status @@ -61,17 +61,16 @@ type UpdateGroup struct { func (o *UpdateGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewUpdateGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *UpdateGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/update_group_parameters.go b/restapi/operations/admin_api/update_group_parameters.go index 30ef0750a..83694e10b 100644 --- a/restapi/operations/admin_api/update_group_parameters.go +++ b/restapi/operations/admin_api/update_group_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewUpdateGroupParams creates a new UpdateGroupParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewUpdateGroupParams() UpdateGroupParams { return UpdateGroupParams{} @@ -86,6 +89,11 @@ func (o *UpdateGroupParams) BindRequest(r *http.Request, route *middleware.Match res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *UpdateGroupParams) BindRequest(r *http.Request, route *middleware.Match } else { res = append(res, errors.Required("body", "body", "")) } + rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *UpdateGroupParams) bindName(rawData []string, hasKey bool, formats strf // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/admin_api/update_tenant.go b/restapi/operations/admin_api/update_tenant.go index c63a8f660..0641fe4dc 100644 --- a/restapi/operations/admin_api/update_tenant.go +++ b/restapi/operations/admin_api/update_tenant.go @@ -48,7 +48,7 @@ func NewUpdateTenant(ctx *middleware.Context, handler UpdateTenantHandler) *Upda return &UpdateTenant{Context: ctx, Handler: handler} } -/*UpdateTenant swagger:route PUT /namespaces/{namespace}/tenants/{tenant} AdminAPI updateTenant +/* UpdateTenant swagger:route PUT /namespaces/{namespace}/tenants/{tenant} AdminAPI updateTenant Update Tenant @@ -61,17 +61,16 @@ type UpdateTenant struct { func (o *UpdateTenant) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewUpdateTenantParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *UpdateTenant) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/update_tenant_parameters.go b/restapi/operations/admin_api/update_tenant_parameters.go index 2a8bedf69..763062b7f 100644 --- a/restapi/operations/admin_api/update_tenant_parameters.go +++ b/restapi/operations/admin_api/update_tenant_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewUpdateTenantParams creates a new UpdateTenantParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewUpdateTenantParams() UpdateTenantParams { return UpdateTenantParams{} @@ -91,6 +94,11 @@ func (o *UpdateTenantParams) BindRequest(r *http.Request, route *middleware.Matc res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -98,6 +106,7 @@ func (o *UpdateTenantParams) BindRequest(r *http.Request, route *middleware.Matc } else { res = append(res, errors.Required("body", "body", "")) } + rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace") if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil { res = append(res, err) @@ -107,7 +116,6 @@ func (o *UpdateTenantParams) BindRequest(r *http.Request, route *middleware.Matc if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -123,7 +131,6 @@ func (o *UpdateTenantParams) bindNamespace(rawData []string, hasKey bool, format // Required: true // Parameter is provided by construction from the route - o.Namespace = raw return nil @@ -138,7 +145,6 @@ func (o *UpdateTenantParams) bindTenant(rawData []string, hasKey bool, formats s // Required: true // Parameter is provided by construction from the route - o.Tenant = raw return nil diff --git a/restapi/operations/admin_api/update_user_groups.go b/restapi/operations/admin_api/update_user_groups.go index 06e4326ae..54b1444e9 100644 --- a/restapi/operations/admin_api/update_user_groups.go +++ b/restapi/operations/admin_api/update_user_groups.go @@ -48,7 +48,7 @@ func NewUpdateUserGroups(ctx *middleware.Context, handler UpdateUserGroupsHandle return &UpdateUserGroups{Context: ctx, Handler: handler} } -/*UpdateUserGroups swagger:route PUT /users/{name}/groups AdminAPI updateUserGroups +/* UpdateUserGroups swagger:route PUT /users/{name}/groups AdminAPI updateUserGroups Update Groups for a user @@ -61,17 +61,16 @@ type UpdateUserGroups struct { func (o *UpdateUserGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewUpdateUserGroupsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *UpdateUserGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/update_user_groups_parameters.go b/restapi/operations/admin_api/update_user_groups_parameters.go index d09d1b3c6..9ab5a1159 100644 --- a/restapi/operations/admin_api/update_user_groups_parameters.go +++ b/restapi/operations/admin_api/update_user_groups_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewUpdateUserGroupsParams creates a new UpdateUserGroupsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewUpdateUserGroupsParams() UpdateUserGroupsParams { return UpdateUserGroupsParams{} @@ -86,6 +89,11 @@ func (o *UpdateUserGroupsParams) BindRequest(r *http.Request, route *middleware. res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *UpdateUserGroupsParams) BindRequest(r *http.Request, route *middleware. } else { res = append(res, errors.Required("body", "body", "")) } + rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *UpdateUserGroupsParams) bindName(rawData []string, hasKey bool, formats // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/admin_api/update_user_info.go b/restapi/operations/admin_api/update_user_info.go index 84dee0310..106c651b6 100644 --- a/restapi/operations/admin_api/update_user_info.go +++ b/restapi/operations/admin_api/update_user_info.go @@ -48,7 +48,7 @@ func NewUpdateUserInfo(ctx *middleware.Context, handler UpdateUserInfoHandler) * return &UpdateUserInfo{Context: ctx, Handler: handler} } -/*UpdateUserInfo swagger:route PUT /users/{name} AdminAPI updateUserInfo +/* UpdateUserInfo swagger:route PUT /users/{name} AdminAPI updateUserInfo Update User Info @@ -61,17 +61,16 @@ type UpdateUserInfo struct { func (o *UpdateUserInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewUpdateUserInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *UpdateUserInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/admin_api/update_user_info_parameters.go b/restapi/operations/admin_api/update_user_info_parameters.go index 39a39f2fb..bd5c6c097 100644 --- a/restapi/operations/admin_api/update_user_info_parameters.go +++ b/restapi/operations/admin_api/update_user_info_parameters.go @@ -23,6 +23,7 @@ package admin_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewUpdateUserInfoParams creates a new UpdateUserInfoParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewUpdateUserInfoParams() UpdateUserInfoParams { return UpdateUserInfoParams{} @@ -86,6 +89,11 @@ func (o *UpdateUserInfoParams) BindRequest(r *http.Request, route *middleware.Ma res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *UpdateUserInfoParams) BindRequest(r *http.Request, route *middleware.Ma } else { res = append(res, errors.Required("body", "body", "")) } + rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *UpdateUserInfoParams) bindName(rawData []string, hasKey bool, formats s // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/console_api.go b/restapi/operations/console_api.go index f4afdc938..739537fbe 100644 --- a/restapi/operations/console_api.go +++ b/restapi/operations/console_api.go @@ -54,6 +54,7 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { PreServerShutdown: func() {}, ServerShutdown: func() {}, spec: spec, + useSwaggerUI: false, ServeError: errors.ServeError, BasicAuthenticator: security.BasicAuth, APIKeyAuthenticator: security.APIKeyAuth, @@ -430,13 +431,16 @@ type ConsoleAPI struct { defaultConsumes string defaultProduces string Middleware func(middleware.Builder) http.Handler + useSwaggerUI bool // BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function. // It has a default implementation in the security package, however you can replace it for your particular usage. BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator + // APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function. // It has a default implementation in the security package, however you can replace it for your particular usage. APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator + // BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function. // It has a default implementation in the security package, however you can replace it for your particular usage. BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator @@ -692,6 +696,7 @@ type ConsoleAPI struct { AdminAPIUpdateUserGroupsHandler admin_api.UpdateUserGroupsHandler // AdminAPIUpdateUserInfoHandler sets the operation handler for the update user info operation AdminAPIUpdateUserInfoHandler admin_api.UpdateUserInfoHandler + // ServeError is called when an error is received, there is a default handler // but you can set your own with this ServeError func(http.ResponseWriter, *http.Request, error) @@ -711,6 +716,16 @@ type ConsoleAPI struct { Logger func(string, ...interface{}) } +// UseRedoc for documentation at /docs +func (o *ConsoleAPI) UseRedoc() { + o.useSwaggerUI = false +} + +// UseSwaggerUI for documentation at /docs +func (o *ConsoleAPI) UseSwaggerUI() { + o.useSwaggerUI = true +} + // SetDefaultProduces sets the default produces media type func (o *ConsoleAPI) SetDefaultProduces(mediaType string) { o.defaultProduces = mediaType @@ -1685,6 +1700,9 @@ func (o *ConsoleAPI) Serve(builder middleware.Builder) http.Handler { if o.Middleware != nil { return o.Middleware(builder) } + if o.useSwaggerUI { + return o.context.APIHandlerSwaggerUI(builder) + } return o.context.APIHandler(builder) } diff --git a/restapi/operations/operator_api/list_node_labels.go b/restapi/operations/operator_api/list_node_labels.go index f2f1147a7..baabd3d6e 100644 --- a/restapi/operations/operator_api/list_node_labels.go +++ b/restapi/operations/operator_api/list_node_labels.go @@ -48,7 +48,7 @@ func NewListNodeLabels(ctx *middleware.Context, handler ListNodeLabelsHandler) * return &ListNodeLabels{Context: ctx, Handler: handler} } -/*ListNodeLabels swagger:route GET /nodes/labels OperatorAPI listNodeLabels +/* ListNodeLabels swagger:route GET /nodes/labels OperatorAPI listNodeLabels List node labels @@ -61,17 +61,16 @@ type ListNodeLabels struct { func (o *ListNodeLabels) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListNodeLabelsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListNodeLabels) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/operator_api/list_node_labels_parameters.go b/restapi/operations/operator_api/list_node_labels_parameters.go index 7b5383aee..29af2bdad 100644 --- a/restapi/operations/operator_api/list_node_labels_parameters.go +++ b/restapi/operations/operator_api/list_node_labels_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewListNodeLabelsParams creates a new ListNodeLabelsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListNodeLabelsParams() ListNodeLabelsParams { return ListNodeLabelsParams{} diff --git a/restapi/operations/user_api/account_change_password.go b/restapi/operations/user_api/account_change_password.go index 3ad313902..6f86a7c89 100644 --- a/restapi/operations/user_api/account_change_password.go +++ b/restapi/operations/user_api/account_change_password.go @@ -48,7 +48,7 @@ func NewAccountChangePassword(ctx *middleware.Context, handler AccountChangePass return &AccountChangePassword{Context: ctx, Handler: handler} } -/*AccountChangePassword swagger:route POST /account/change-password UserAPI accountChangePassword +/* AccountChangePassword swagger:route POST /account/change-password UserAPI accountChangePassword Change password of currently logged in user. @@ -61,17 +61,16 @@ type AccountChangePassword struct { func (o *AccountChangePassword) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewAccountChangePasswordParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *AccountChangePassword) ServeHTTP(rw http.ResponseWriter, r *http.Reques } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/account_change_password_parameters.go b/restapi/operations/user_api/account_change_password_parameters.go index f646c1b5a..6bbf6640f 100644 --- a/restapi/operations/user_api/account_change_password_parameters.go +++ b/restapi/operations/user_api/account_change_password_parameters.go @@ -23,18 +23,21 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewAccountChangePasswordParams creates a new AccountChangePasswordParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewAccountChangePasswordParams() AccountChangePasswordParams { return AccountChangePasswordParams{} @@ -80,6 +83,11 @@ func (o *AccountChangePasswordParams) BindRequest(r *http.Request, route *middle res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/user_api/add_bucket_lifecycle.go b/restapi/operations/user_api/add_bucket_lifecycle.go index 8f18677f1..cdc757c48 100644 --- a/restapi/operations/user_api/add_bucket_lifecycle.go +++ b/restapi/operations/user_api/add_bucket_lifecycle.go @@ -48,7 +48,7 @@ func NewAddBucketLifecycle(ctx *middleware.Context, handler AddBucketLifecycleHa return &AddBucketLifecycle{Context: ctx, Handler: handler} } -/*AddBucketLifecycle swagger:route POST /buckets/{bucket_name}/lifecycle UserAPI addBucketLifecycle +/* AddBucketLifecycle swagger:route POST /buckets/{bucket_name}/lifecycle UserAPI addBucketLifecycle Add Bucket Lifecycle @@ -61,17 +61,16 @@ type AddBucketLifecycle struct { func (o *AddBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewAddBucketLifecycleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *AddBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/add_bucket_lifecycle_parameters.go b/restapi/operations/user_api/add_bucket_lifecycle_parameters.go index 1b6c90281..7aa9c8f00 100644 --- a/restapi/operations/user_api/add_bucket_lifecycle_parameters.go +++ b/restapi/operations/user_api/add_bucket_lifecycle_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewAddBucketLifecycleParams creates a new AddBucketLifecycleParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewAddBucketLifecycleParams() AddBucketLifecycleParams { return AddBucketLifecycleParams{} @@ -86,6 +89,11 @@ func (o *AddBucketLifecycleParams) BindRequest(r *http.Request, route *middlewar res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *AddBucketLifecycleParams) BindRequest(r *http.Request, route *middlewar } else { res = append(res, errors.Required("body", "body", "")) } + rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *AddBucketLifecycleParams) bindBucketName(rawData []string, hasKey bool, // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/add_remote_bucket.go b/restapi/operations/user_api/add_remote_bucket.go index 57cd3180b..a81101a27 100644 --- a/restapi/operations/user_api/add_remote_bucket.go +++ b/restapi/operations/user_api/add_remote_bucket.go @@ -48,7 +48,7 @@ func NewAddRemoteBucket(ctx *middleware.Context, handler AddRemoteBucketHandler) return &AddRemoteBucket{Context: ctx, Handler: handler} } -/*AddRemoteBucket swagger:route POST /remote-buckets UserAPI addRemoteBucket +/* AddRemoteBucket swagger:route POST /remote-buckets UserAPI addRemoteBucket Add Remote Bucket @@ -61,17 +61,16 @@ type AddRemoteBucket struct { func (o *AddRemoteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewAddRemoteBucketParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *AddRemoteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/add_remote_bucket_parameters.go b/restapi/operations/user_api/add_remote_bucket_parameters.go index e19c4038d..3f1f1b459 100644 --- a/restapi/operations/user_api/add_remote_bucket_parameters.go +++ b/restapi/operations/user_api/add_remote_bucket_parameters.go @@ -23,18 +23,21 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewAddRemoteBucketParams creates a new AddRemoteBucketParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewAddRemoteBucketParams() AddRemoteBucketParams { return AddRemoteBucketParams{} @@ -80,6 +83,11 @@ func (o *AddRemoteBucketParams) BindRequest(r *http.Request, route *middleware.M res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/user_api/bucket_info.go b/restapi/operations/user_api/bucket_info.go index 84904f2e0..222f69c85 100644 --- a/restapi/operations/user_api/bucket_info.go +++ b/restapi/operations/user_api/bucket_info.go @@ -48,7 +48,7 @@ func NewBucketInfo(ctx *middleware.Context, handler BucketInfoHandler) *BucketIn return &BucketInfo{Context: ctx, Handler: handler} } -/*BucketInfo swagger:route GET /buckets/{name} UserAPI bucketInfo +/* BucketInfo swagger:route GET /buckets/{name} UserAPI bucketInfo Bucket Info @@ -61,17 +61,16 @@ type BucketInfo struct { func (o *BucketInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewBucketInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *BucketInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/bucket_info_parameters.go b/restapi/operations/user_api/bucket_info_parameters.go index 745f1881f..fd61df5af 100644 --- a/restapi/operations/user_api/bucket_info_parameters.go +++ b/restapi/operations/user_api/bucket_info_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewBucketInfoParams creates a new BucketInfoParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewBucketInfoParams() BucketInfoParams { return BucketInfoParams{} @@ -66,7 +67,6 @@ func (o *BucketInfoParams) BindRequest(r *http.Request, route *middleware.Matche if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *BucketInfoParams) bindName(rawData []string, hasKey bool, formats strfm // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/user_api/bucket_set_policy.go b/restapi/operations/user_api/bucket_set_policy.go index afbe56b0d..189a297e7 100644 --- a/restapi/operations/user_api/bucket_set_policy.go +++ b/restapi/operations/user_api/bucket_set_policy.go @@ -48,7 +48,7 @@ func NewBucketSetPolicy(ctx *middleware.Context, handler BucketSetPolicyHandler) return &BucketSetPolicy{Context: ctx, Handler: handler} } -/*BucketSetPolicy swagger:route PUT /buckets/{name}/set-policy UserAPI bucketSetPolicy +/* BucketSetPolicy swagger:route PUT /buckets/{name}/set-policy UserAPI bucketSetPolicy Bucket Set Policy @@ -61,17 +61,16 @@ type BucketSetPolicy struct { func (o *BucketSetPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewBucketSetPolicyParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *BucketSetPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/bucket_set_policy_parameters.go b/restapi/operations/user_api/bucket_set_policy_parameters.go index 4eeda232f..185fcffe1 100644 --- a/restapi/operations/user_api/bucket_set_policy_parameters.go +++ b/restapi/operations/user_api/bucket_set_policy_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewBucketSetPolicyParams creates a new BucketSetPolicyParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewBucketSetPolicyParams() BucketSetPolicyParams { return BucketSetPolicyParams{} @@ -86,6 +89,11 @@ func (o *BucketSetPolicyParams) BindRequest(r *http.Request, route *middleware.M res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *BucketSetPolicyParams) BindRequest(r *http.Request, route *middleware.M } else { res = append(res, errors.Required("body", "body", "")) } + rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *BucketSetPolicyParams) bindName(rawData []string, hasKey bool, formats // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/user_api/create_bucket_event.go b/restapi/operations/user_api/create_bucket_event.go index 786a4faeb..460559084 100644 --- a/restapi/operations/user_api/create_bucket_event.go +++ b/restapi/operations/user_api/create_bucket_event.go @@ -48,7 +48,7 @@ func NewCreateBucketEvent(ctx *middleware.Context, handler CreateBucketEventHand return &CreateBucketEvent{Context: ctx, Handler: handler} } -/*CreateBucketEvent swagger:route POST /buckets/{bucket_name}/events UserAPI createBucketEvent +/* CreateBucketEvent swagger:route POST /buckets/{bucket_name}/events UserAPI createBucketEvent Create Bucket Event @@ -61,17 +61,16 @@ type CreateBucketEvent struct { func (o *CreateBucketEvent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewCreateBucketEventParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *CreateBucketEvent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/create_bucket_event_parameters.go b/restapi/operations/user_api/create_bucket_event_parameters.go index f9eb3ea7c..b6fe3cecb 100644 --- a/restapi/operations/user_api/create_bucket_event_parameters.go +++ b/restapi/operations/user_api/create_bucket_event_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewCreateBucketEventParams creates a new CreateBucketEventParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewCreateBucketEventParams() CreateBucketEventParams { return CreateBucketEventParams{} @@ -86,6 +89,11 @@ func (o *CreateBucketEventParams) BindRequest(r *http.Request, route *middleware res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *CreateBucketEventParams) BindRequest(r *http.Request, route *middleware } else { res = append(res, errors.Required("body", "body", "")) } + rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *CreateBucketEventParams) bindBucketName(rawData []string, hasKey bool, // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/create_service_account.go b/restapi/operations/user_api/create_service_account.go index 7e2485985..7e50df904 100644 --- a/restapi/operations/user_api/create_service_account.go +++ b/restapi/operations/user_api/create_service_account.go @@ -48,7 +48,7 @@ func NewCreateServiceAccount(ctx *middleware.Context, handler CreateServiceAccou return &CreateServiceAccount{Context: ctx, Handler: handler} } -/*CreateServiceAccount swagger:route POST /service-accounts UserAPI createServiceAccount +/* CreateServiceAccount swagger:route POST /service-accounts UserAPI createServiceAccount Create Service Account @@ -61,17 +61,16 @@ type CreateServiceAccount struct { func (o *CreateServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewCreateServiceAccountParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *CreateServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/create_service_account_parameters.go b/restapi/operations/user_api/create_service_account_parameters.go index ed5ef2a49..06f427f1d 100644 --- a/restapi/operations/user_api/create_service_account_parameters.go +++ b/restapi/operations/user_api/create_service_account_parameters.go @@ -23,18 +23,21 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewCreateServiceAccountParams creates a new CreateServiceAccountParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewCreateServiceAccountParams() CreateServiceAccountParams { return CreateServiceAccountParams{} @@ -80,6 +83,11 @@ func (o *CreateServiceAccountParams) BindRequest(r *http.Request, route *middlew res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/user_api/delete_bucket.go b/restapi/operations/user_api/delete_bucket.go index 13e5d1c28..1b979110e 100644 --- a/restapi/operations/user_api/delete_bucket.go +++ b/restapi/operations/user_api/delete_bucket.go @@ -48,7 +48,7 @@ func NewDeleteBucket(ctx *middleware.Context, handler DeleteBucketHandler) *Dele return &DeleteBucket{Context: ctx, Handler: handler} } -/*DeleteBucket swagger:route DELETE /buckets/{name} UserAPI deleteBucket +/* DeleteBucket swagger:route DELETE /buckets/{name} UserAPI deleteBucket Delete Bucket @@ -61,17 +61,16 @@ type DeleteBucket struct { func (o *DeleteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDeleteBucketParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DeleteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/delete_bucket_event.go b/restapi/operations/user_api/delete_bucket_event.go index 2c2f0ba44..405d0856a 100644 --- a/restapi/operations/user_api/delete_bucket_event.go +++ b/restapi/operations/user_api/delete_bucket_event.go @@ -48,7 +48,7 @@ func NewDeleteBucketEvent(ctx *middleware.Context, handler DeleteBucketEventHand return &DeleteBucketEvent{Context: ctx, Handler: handler} } -/*DeleteBucketEvent swagger:route DELETE /buckets/{bucket_name}/events/{arn} UserAPI deleteBucketEvent +/* DeleteBucketEvent swagger:route DELETE /buckets/{bucket_name}/events/{arn} UserAPI deleteBucketEvent Delete Bucket Event @@ -61,17 +61,16 @@ type DeleteBucketEvent struct { func (o *DeleteBucketEvent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDeleteBucketEventParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DeleteBucketEvent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/delete_bucket_event_parameters.go b/restapi/operations/user_api/delete_bucket_event_parameters.go index f31166b12..5ccedec0b 100644 --- a/restapi/operations/user_api/delete_bucket_event_parameters.go +++ b/restapi/operations/user_api/delete_bucket_event_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewDeleteBucketEventParams creates a new DeleteBucketEventParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDeleteBucketEventParams() DeleteBucketEventParams { return DeleteBucketEventParams{} @@ -96,6 +99,11 @@ func (o *DeleteBucketEventParams) BindRequest(r *http.Request, route *middleware res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -103,11 +111,11 @@ func (o *DeleteBucketEventParams) BindRequest(r *http.Request, route *middleware } else { res = append(res, errors.Required("body", "body", "")) } + rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -123,7 +131,6 @@ func (o *DeleteBucketEventParams) bindArn(rawData []string, hasKey bool, formats // Required: true // Parameter is provided by construction from the route - o.Arn = raw return nil @@ -138,7 +145,6 @@ func (o *DeleteBucketEventParams) bindBucketName(rawData []string, hasKey bool, // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/delete_bucket_parameters.go b/restapi/operations/user_api/delete_bucket_parameters.go index e5f2f1b0f..e0e34aff6 100644 --- a/restapi/operations/user_api/delete_bucket_parameters.go +++ b/restapi/operations/user_api/delete_bucket_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewDeleteBucketParams creates a new DeleteBucketParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDeleteBucketParams() DeleteBucketParams { return DeleteBucketParams{} @@ -66,7 +67,6 @@ func (o *DeleteBucketParams) BindRequest(r *http.Request, route *middleware.Matc if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *DeleteBucketParams) bindName(rawData []string, hasKey bool, formats str // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/user_api/delete_bucket_replication_rule.go b/restapi/operations/user_api/delete_bucket_replication_rule.go index 6faa2f363..56ed94c15 100644 --- a/restapi/operations/user_api/delete_bucket_replication_rule.go +++ b/restapi/operations/user_api/delete_bucket_replication_rule.go @@ -48,7 +48,7 @@ func NewDeleteBucketReplicationRule(ctx *middleware.Context, handler DeleteBucke return &DeleteBucketReplicationRule{Context: ctx, Handler: handler} } -/*DeleteBucketReplicationRule swagger:route DELETE /buckets/{bucket_name}/replication/{rule_id} UserAPI deleteBucketReplicationRule +/* DeleteBucketReplicationRule swagger:route DELETE /buckets/{bucket_name}/replication/{rule_id} UserAPI deleteBucketReplicationRule Bucket Replication Rule Delete @@ -61,17 +61,16 @@ type DeleteBucketReplicationRule struct { func (o *DeleteBucketReplicationRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDeleteBucketReplicationRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DeleteBucketReplicationRule) ServeHTTP(rw http.ResponseWriter, r *http. } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/delete_bucket_replication_rule_parameters.go b/restapi/operations/user_api/delete_bucket_replication_rule_parameters.go index b9d52801c..99fc94426 100644 --- a/restapi/operations/user_api/delete_bucket_replication_rule_parameters.go +++ b/restapi/operations/user_api/delete_bucket_replication_rule_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewDeleteBucketReplicationRuleParams creates a new DeleteBucketReplicationRuleParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDeleteBucketReplicationRuleParams() DeleteBucketReplicationRuleParams { return DeleteBucketReplicationRuleParams{} @@ -76,7 +77,6 @@ func (o *DeleteBucketReplicationRuleParams) BindRequest(r *http.Request, route * if err := o.bindRuleID(rRuleID, rhkRuleID, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -92,7 +92,6 @@ func (o *DeleteBucketReplicationRuleParams) bindBucketName(rawData []string, has // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -107,7 +106,6 @@ func (o *DeleteBucketReplicationRuleParams) bindRuleID(rawData []string, hasKey // Required: true // Parameter is provided by construction from the route - o.RuleID = raw return nil diff --git a/restapi/operations/user_api/delete_object.go b/restapi/operations/user_api/delete_object.go index d7146744f..4e76ff98b 100644 --- a/restapi/operations/user_api/delete_object.go +++ b/restapi/operations/user_api/delete_object.go @@ -48,7 +48,7 @@ func NewDeleteObject(ctx *middleware.Context, handler DeleteObjectHandler) *Dele return &DeleteObject{Context: ctx, Handler: handler} } -/*DeleteObject swagger:route DELETE /buckets/{bucket_name}/objects UserAPI deleteObject +/* DeleteObject swagger:route DELETE /buckets/{bucket_name}/objects UserAPI deleteObject Delete Object @@ -61,17 +61,16 @@ type DeleteObject struct { func (o *DeleteObject) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDeleteObjectParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DeleteObject) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/delete_object_parameters.go b/restapi/operations/user_api/delete_object_parameters.go index f2cdacfc7..627429fce 100644 --- a/restapi/operations/user_api/delete_object_parameters.go +++ b/restapi/operations/user_api/delete_object_parameters.go @@ -34,7 +34,8 @@ import ( ) // NewDeleteObjectParams creates a new DeleteObjectParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDeleteObjectParams() DeleteObjectParams { return DeleteObjectParams{} @@ -99,7 +100,6 @@ func (o *DeleteObjectParams) BindRequest(r *http.Request, route *middleware.Matc if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -115,7 +115,6 @@ func (o *DeleteObjectParams) bindBucketName(rawData []string, hasKey bool, forma // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -133,10 +132,10 @@ func (o *DeleteObjectParams) bindPath(rawData []string, hasKey bool, formats str // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("path", "query", raw); err != nil { return err } - o.Path = raw return nil @@ -151,6 +150,7 @@ func (o *DeleteObjectParams) bindRecursive(rawData []string, hasKey bool, format // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -173,10 +173,10 @@ func (o *DeleteObjectParams) bindVersionID(rawData []string, hasKey bool, format // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.VersionID = &raw return nil diff --git a/restapi/operations/user_api/delete_object_retention.go b/restapi/operations/user_api/delete_object_retention.go index 7d889acab..08af2452d 100644 --- a/restapi/operations/user_api/delete_object_retention.go +++ b/restapi/operations/user_api/delete_object_retention.go @@ -48,7 +48,7 @@ func NewDeleteObjectRetention(ctx *middleware.Context, handler DeleteObjectReten return &DeleteObjectRetention{Context: ctx, Handler: handler} } -/*DeleteObjectRetention swagger:route DELETE /buckets/{bucket_name}/objects/retention UserAPI deleteObjectRetention +/* DeleteObjectRetention swagger:route DELETE /buckets/{bucket_name}/objects/retention UserAPI deleteObjectRetention Delete Object retention from an object @@ -61,17 +61,16 @@ type DeleteObjectRetention struct { func (o *DeleteObjectRetention) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDeleteObjectRetentionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DeleteObjectRetention) ServeHTTP(rw http.ResponseWriter, r *http.Reques } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/delete_object_retention_parameters.go b/restapi/operations/user_api/delete_object_retention_parameters.go index afeb9569f..1d0ccfa61 100644 --- a/restapi/operations/user_api/delete_object_retention_parameters.go +++ b/restapi/operations/user_api/delete_object_retention_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewDeleteObjectRetentionParams creates a new DeleteObjectRetentionParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDeleteObjectRetentionParams() DeleteObjectRetentionParams { return DeleteObjectRetentionParams{} @@ -90,7 +91,6 @@ func (o *DeleteObjectRetentionParams) BindRequest(r *http.Request, route *middle if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -106,7 +106,6 @@ func (o *DeleteObjectRetentionParams) bindBucketName(rawData []string, hasKey bo // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -124,10 +123,10 @@ func (o *DeleteObjectRetentionParams) bindPrefix(rawData []string, hasKey bool, // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } - o.Prefix = raw return nil @@ -145,10 +144,10 @@ func (o *DeleteObjectRetentionParams) bindVersionID(rawData []string, hasKey boo // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("version_id", "query", raw); err != nil { return err } - o.VersionID = raw return nil diff --git a/restapi/operations/user_api/delete_remote_bucket.go b/restapi/operations/user_api/delete_remote_bucket.go index bfa72c34f..8b6d85219 100644 --- a/restapi/operations/user_api/delete_remote_bucket.go +++ b/restapi/operations/user_api/delete_remote_bucket.go @@ -48,7 +48,7 @@ func NewDeleteRemoteBucket(ctx *middleware.Context, handler DeleteRemoteBucketHa return &DeleteRemoteBucket{Context: ctx, Handler: handler} } -/*DeleteRemoteBucket swagger:route DELETE /remote-buckets/{source-bucket-name}/{arn} UserAPI deleteRemoteBucket +/* DeleteRemoteBucket swagger:route DELETE /remote-buckets/{source-bucket-name}/{arn} UserAPI deleteRemoteBucket Delete Remote Bucket @@ -61,17 +61,16 @@ type DeleteRemoteBucket struct { func (o *DeleteRemoteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDeleteRemoteBucketParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DeleteRemoteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/delete_remote_bucket_parameters.go b/restapi/operations/user_api/delete_remote_bucket_parameters.go index 8d07062ad..b0f58e6e0 100644 --- a/restapi/operations/user_api/delete_remote_bucket_parameters.go +++ b/restapi/operations/user_api/delete_remote_bucket_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewDeleteRemoteBucketParams creates a new DeleteRemoteBucketParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDeleteRemoteBucketParams() DeleteRemoteBucketParams { return DeleteRemoteBucketParams{} @@ -76,7 +77,6 @@ func (o *DeleteRemoteBucketParams) BindRequest(r *http.Request, route *middlewar if err := o.bindSourceBucketName(rSourceBucketName, rhkSourceBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -92,7 +92,6 @@ func (o *DeleteRemoteBucketParams) bindArn(rawData []string, hasKey bool, format // Required: true // Parameter is provided by construction from the route - o.Arn = raw return nil @@ -107,7 +106,6 @@ func (o *DeleteRemoteBucketParams) bindSourceBucketName(rawData []string, hasKey // Required: true // Parameter is provided by construction from the route - o.SourceBucketName = raw return nil diff --git a/restapi/operations/user_api/delete_service_account.go b/restapi/operations/user_api/delete_service_account.go index 65c545368..a67371422 100644 --- a/restapi/operations/user_api/delete_service_account.go +++ b/restapi/operations/user_api/delete_service_account.go @@ -48,7 +48,7 @@ func NewDeleteServiceAccount(ctx *middleware.Context, handler DeleteServiceAccou return &DeleteServiceAccount{Context: ctx, Handler: handler} } -/*DeleteServiceAccount swagger:route DELETE /service-accounts/{access_key} UserAPI deleteServiceAccount +/* DeleteServiceAccount swagger:route DELETE /service-accounts/{access_key} UserAPI deleteServiceAccount Delete Service Account @@ -61,17 +61,16 @@ type DeleteServiceAccount struct { func (o *DeleteServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDeleteServiceAccountParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DeleteServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/delete_service_account_parameters.go b/restapi/operations/user_api/delete_service_account_parameters.go index 5bd85cb06..0d4d5c584 100644 --- a/restapi/operations/user_api/delete_service_account_parameters.go +++ b/restapi/operations/user_api/delete_service_account_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewDeleteServiceAccountParams creates a new DeleteServiceAccountParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDeleteServiceAccountParams() DeleteServiceAccountParams { return DeleteServiceAccountParams{} @@ -66,7 +67,6 @@ func (o *DeleteServiceAccountParams) BindRequest(r *http.Request, route *middlew if err := o.bindAccessKey(rAccessKey, rhkAccessKey, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *DeleteServiceAccountParams) bindAccessKey(rawData []string, hasKey bool // Required: true // Parameter is provided by construction from the route - o.AccessKey = raw return nil diff --git a/restapi/operations/user_api/disable_bucket_encryption.go b/restapi/operations/user_api/disable_bucket_encryption.go index dc6574b4d..00f752695 100644 --- a/restapi/operations/user_api/disable_bucket_encryption.go +++ b/restapi/operations/user_api/disable_bucket_encryption.go @@ -48,7 +48,7 @@ func NewDisableBucketEncryption(ctx *middleware.Context, handler DisableBucketEn return &DisableBucketEncryption{Context: ctx, Handler: handler} } -/*DisableBucketEncryption swagger:route POST /buckets/{bucket_name}/encryption/disable UserAPI disableBucketEncryption +/* DisableBucketEncryption swagger:route POST /buckets/{bucket_name}/encryption/disable UserAPI disableBucketEncryption Disable bucket encryption. @@ -61,17 +61,16 @@ type DisableBucketEncryption struct { func (o *DisableBucketEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDisableBucketEncryptionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DisableBucketEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Requ } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/disable_bucket_encryption_parameters.go b/restapi/operations/user_api/disable_bucket_encryption_parameters.go index 366a54039..fa313cfd8 100644 --- a/restapi/operations/user_api/disable_bucket_encryption_parameters.go +++ b/restapi/operations/user_api/disable_bucket_encryption_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewDisableBucketEncryptionParams creates a new DisableBucketEncryptionParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDisableBucketEncryptionParams() DisableBucketEncryptionParams { return DisableBucketEncryptionParams{} @@ -66,7 +67,6 @@ func (o *DisableBucketEncryptionParams) BindRequest(r *http.Request, route *midd if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *DisableBucketEncryptionParams) bindBucketName(rawData []string, hasKey // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/download_object.go b/restapi/operations/user_api/download_object.go index 6c8a98e3e..89e601dc6 100644 --- a/restapi/operations/user_api/download_object.go +++ b/restapi/operations/user_api/download_object.go @@ -48,7 +48,7 @@ func NewDownloadObject(ctx *middleware.Context, handler DownloadObjectHandler) * return &DownloadObject{Context: ctx, Handler: handler} } -/*DownloadObject swagger:route GET /buckets/{bucket_name}/objects/download UserAPI downloadObject +/* DownloadObject swagger:route GET /buckets/{bucket_name}/objects/download UserAPI downloadObject Download Object @@ -61,17 +61,16 @@ type DownloadObject struct { func (o *DownloadObject) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewDownloadObjectParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *DownloadObject) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/download_object_parameters.go b/restapi/operations/user_api/download_object_parameters.go index d87f862b4..b5c6088cf 100644 --- a/restapi/operations/user_api/download_object_parameters.go +++ b/restapi/operations/user_api/download_object_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewDownloadObjectParams creates a new DownloadObjectParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewDownloadObjectParams() DownloadObjectParams { return DownloadObjectParams{} @@ -89,7 +90,6 @@ func (o *DownloadObjectParams) BindRequest(r *http.Request, route *middleware.Ma if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -105,7 +105,6 @@ func (o *DownloadObjectParams) bindBucketName(rawData []string, hasKey bool, for // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -123,10 +122,10 @@ func (o *DownloadObjectParams) bindPrefix(rawData []string, hasKey bool, formats // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } - o.Prefix = raw return nil @@ -141,10 +140,10 @@ func (o *DownloadObjectParams) bindVersionID(rawData []string, hasKey bool, form // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.VersionID = &raw return nil diff --git a/restapi/operations/user_api/enable_bucket_encryption.go b/restapi/operations/user_api/enable_bucket_encryption.go index b574f5120..7b34a2ed5 100644 --- a/restapi/operations/user_api/enable_bucket_encryption.go +++ b/restapi/operations/user_api/enable_bucket_encryption.go @@ -48,7 +48,7 @@ func NewEnableBucketEncryption(ctx *middleware.Context, handler EnableBucketEncr return &EnableBucketEncryption{Context: ctx, Handler: handler} } -/*EnableBucketEncryption swagger:route POST /buckets/{bucket_name}/encryption/enable UserAPI enableBucketEncryption +/* EnableBucketEncryption swagger:route POST /buckets/{bucket_name}/encryption/enable UserAPI enableBucketEncryption Enable bucket encryption. @@ -61,17 +61,16 @@ type EnableBucketEncryption struct { func (o *EnableBucketEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewEnableBucketEncryptionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *EnableBucketEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Reque } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/enable_bucket_encryption_parameters.go b/restapi/operations/user_api/enable_bucket_encryption_parameters.go index b38ab439e..5787b899f 100644 --- a/restapi/operations/user_api/enable_bucket_encryption_parameters.go +++ b/restapi/operations/user_api/enable_bucket_encryption_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewEnableBucketEncryptionParams creates a new EnableBucketEncryptionParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewEnableBucketEncryptionParams() EnableBucketEncryptionParams { return EnableBucketEncryptionParams{} @@ -86,6 +89,11 @@ func (o *EnableBucketEncryptionParams) BindRequest(r *http.Request, route *middl res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *EnableBucketEncryptionParams) BindRequest(r *http.Request, route *middl } else { res = append(res, errors.Required("body", "body", "")) } + rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *EnableBucketEncryptionParams) bindBucketName(rawData []string, hasKey b // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/get_bucket_encryption_info.go b/restapi/operations/user_api/get_bucket_encryption_info.go index f0218b049..e780c1697 100644 --- a/restapi/operations/user_api/get_bucket_encryption_info.go +++ b/restapi/operations/user_api/get_bucket_encryption_info.go @@ -48,7 +48,7 @@ func NewGetBucketEncryptionInfo(ctx *middleware.Context, handler GetBucketEncryp return &GetBucketEncryptionInfo{Context: ctx, Handler: handler} } -/*GetBucketEncryptionInfo swagger:route GET /buckets/{bucket_name}/encryption/info UserAPI getBucketEncryptionInfo +/* GetBucketEncryptionInfo swagger:route GET /buckets/{bucket_name}/encryption/info UserAPI getBucketEncryptionInfo Get bucket encryption information. @@ -61,17 +61,16 @@ type GetBucketEncryptionInfo struct { func (o *GetBucketEncryptionInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetBucketEncryptionInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetBucketEncryptionInfo) ServeHTTP(rw http.ResponseWriter, r *http.Requ } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/get_bucket_encryption_info_parameters.go b/restapi/operations/user_api/get_bucket_encryption_info_parameters.go index 644e345ce..82bb870f3 100644 --- a/restapi/operations/user_api/get_bucket_encryption_info_parameters.go +++ b/restapi/operations/user_api/get_bucket_encryption_info_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetBucketEncryptionInfoParams creates a new GetBucketEncryptionInfoParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetBucketEncryptionInfoParams() GetBucketEncryptionInfoParams { return GetBucketEncryptionInfoParams{} @@ -66,7 +67,6 @@ func (o *GetBucketEncryptionInfoParams) BindRequest(r *http.Request, route *midd if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *GetBucketEncryptionInfoParams) bindBucketName(rawData []string, hasKey // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/get_bucket_lifecycle.go b/restapi/operations/user_api/get_bucket_lifecycle.go index 2cc6b86a0..d8413de66 100644 --- a/restapi/operations/user_api/get_bucket_lifecycle.go +++ b/restapi/operations/user_api/get_bucket_lifecycle.go @@ -48,7 +48,7 @@ func NewGetBucketLifecycle(ctx *middleware.Context, handler GetBucketLifecycleHa return &GetBucketLifecycle{Context: ctx, Handler: handler} } -/*GetBucketLifecycle swagger:route GET /buckets/{bucket_name}/lifecycle UserAPI getBucketLifecycle +/* GetBucketLifecycle swagger:route GET /buckets/{bucket_name}/lifecycle UserAPI getBucketLifecycle Bucket Lifecycle @@ -61,17 +61,16 @@ type GetBucketLifecycle struct { func (o *GetBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetBucketLifecycleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/get_bucket_lifecycle_parameters.go b/restapi/operations/user_api/get_bucket_lifecycle_parameters.go index c5dd9c6e7..a06f4cce4 100644 --- a/restapi/operations/user_api/get_bucket_lifecycle_parameters.go +++ b/restapi/operations/user_api/get_bucket_lifecycle_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetBucketLifecycleParams creates a new GetBucketLifecycleParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetBucketLifecycleParams() GetBucketLifecycleParams { return GetBucketLifecycleParams{} @@ -66,7 +67,6 @@ func (o *GetBucketLifecycleParams) BindRequest(r *http.Request, route *middlewar if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *GetBucketLifecycleParams) bindBucketName(rawData []string, hasKey bool, // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/get_bucket_object_locking_status.go b/restapi/operations/user_api/get_bucket_object_locking_status.go index 1b7824aac..d950020dd 100644 --- a/restapi/operations/user_api/get_bucket_object_locking_status.go +++ b/restapi/operations/user_api/get_bucket_object_locking_status.go @@ -48,7 +48,7 @@ func NewGetBucketObjectLockingStatus(ctx *middleware.Context, handler GetBucketO return &GetBucketObjectLockingStatus{Context: ctx, Handler: handler} } -/*GetBucketObjectLockingStatus swagger:route GET /buckets/{bucket_name}/object-locking UserAPI getBucketObjectLockingStatus +/* GetBucketObjectLockingStatus swagger:route GET /buckets/{bucket_name}/object-locking UserAPI getBucketObjectLockingStatus Returns the status of object locking support on the bucket @@ -61,17 +61,16 @@ type GetBucketObjectLockingStatus struct { func (o *GetBucketObjectLockingStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetBucketObjectLockingStatusParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetBucketObjectLockingStatus) ServeHTTP(rw http.ResponseWriter, r *http } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/get_bucket_object_locking_status_parameters.go b/restapi/operations/user_api/get_bucket_object_locking_status_parameters.go index a2a797cf6..1c16ee1e4 100644 --- a/restapi/operations/user_api/get_bucket_object_locking_status_parameters.go +++ b/restapi/operations/user_api/get_bucket_object_locking_status_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetBucketObjectLockingStatusParams creates a new GetBucketObjectLockingStatusParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetBucketObjectLockingStatusParams() GetBucketObjectLockingStatusParams { return GetBucketObjectLockingStatusParams{} @@ -66,7 +67,6 @@ func (o *GetBucketObjectLockingStatusParams) BindRequest(r *http.Request, route if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *GetBucketObjectLockingStatusParams) bindBucketName(rawData []string, ha // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/get_bucket_quota.go b/restapi/operations/user_api/get_bucket_quota.go index 1ae3b3738..ec5e1d269 100644 --- a/restapi/operations/user_api/get_bucket_quota.go +++ b/restapi/operations/user_api/get_bucket_quota.go @@ -48,7 +48,7 @@ func NewGetBucketQuota(ctx *middleware.Context, handler GetBucketQuotaHandler) * return &GetBucketQuota{Context: ctx, Handler: handler} } -/*GetBucketQuota swagger:route GET /buckets/{name}/quota UserAPI getBucketQuota +/* GetBucketQuota swagger:route GET /buckets/{name}/quota UserAPI getBucketQuota Get Bucket Quota @@ -61,17 +61,16 @@ type GetBucketQuota struct { func (o *GetBucketQuota) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetBucketQuotaParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetBucketQuota) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/get_bucket_quota_parameters.go b/restapi/operations/user_api/get_bucket_quota_parameters.go index 91077df75..a430c1de1 100644 --- a/restapi/operations/user_api/get_bucket_quota_parameters.go +++ b/restapi/operations/user_api/get_bucket_quota_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetBucketQuotaParams creates a new GetBucketQuotaParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetBucketQuotaParams() GetBucketQuotaParams { return GetBucketQuotaParams{} @@ -66,7 +67,6 @@ func (o *GetBucketQuotaParams) BindRequest(r *http.Request, route *middleware.Ma if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *GetBucketQuotaParams) bindName(rawData []string, hasKey bool, formats s // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/user_api/get_bucket_replication.go b/restapi/operations/user_api/get_bucket_replication.go index 3725b6277..ba10c160f 100644 --- a/restapi/operations/user_api/get_bucket_replication.go +++ b/restapi/operations/user_api/get_bucket_replication.go @@ -48,7 +48,7 @@ func NewGetBucketReplication(ctx *middleware.Context, handler GetBucketReplicati return &GetBucketReplication{Context: ctx, Handler: handler} } -/*GetBucketReplication swagger:route GET /buckets/{bucket_name}/replication UserAPI getBucketReplication +/* GetBucketReplication swagger:route GET /buckets/{bucket_name}/replication UserAPI getBucketReplication Bucket Replication @@ -61,17 +61,16 @@ type GetBucketReplication struct { func (o *GetBucketReplication) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetBucketReplicationParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetBucketReplication) ServeHTTP(rw http.ResponseWriter, r *http.Request } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/get_bucket_replication_parameters.go b/restapi/operations/user_api/get_bucket_replication_parameters.go index 1dc7377f8..ff83c4e28 100644 --- a/restapi/operations/user_api/get_bucket_replication_parameters.go +++ b/restapi/operations/user_api/get_bucket_replication_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetBucketReplicationParams creates a new GetBucketReplicationParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetBucketReplicationParams() GetBucketReplicationParams { return GetBucketReplicationParams{} @@ -66,7 +67,6 @@ func (o *GetBucketReplicationParams) BindRequest(r *http.Request, route *middlew if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *GetBucketReplicationParams) bindBucketName(rawData []string, hasKey boo // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/get_bucket_retention_config.go b/restapi/operations/user_api/get_bucket_retention_config.go index 205eb4786..3781e8702 100644 --- a/restapi/operations/user_api/get_bucket_retention_config.go +++ b/restapi/operations/user_api/get_bucket_retention_config.go @@ -48,7 +48,7 @@ func NewGetBucketRetentionConfig(ctx *middleware.Context, handler GetBucketReten return &GetBucketRetentionConfig{Context: ctx, Handler: handler} } -/*GetBucketRetentionConfig swagger:route GET /buckets/{bucket_name}/retention UserAPI getBucketRetentionConfig +/* GetBucketRetentionConfig swagger:route GET /buckets/{bucket_name}/retention UserAPI getBucketRetentionConfig Get Bucket's retention config @@ -61,17 +61,16 @@ type GetBucketRetentionConfig struct { func (o *GetBucketRetentionConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetBucketRetentionConfigParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetBucketRetentionConfig) ServeHTTP(rw http.ResponseWriter, r *http.Req } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/get_bucket_retention_config_parameters.go b/restapi/operations/user_api/get_bucket_retention_config_parameters.go index 2ebbc1a7a..a7f1b05d4 100644 --- a/restapi/operations/user_api/get_bucket_retention_config_parameters.go +++ b/restapi/operations/user_api/get_bucket_retention_config_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetBucketRetentionConfigParams creates a new GetBucketRetentionConfigParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetBucketRetentionConfigParams() GetBucketRetentionConfigParams { return GetBucketRetentionConfigParams{} @@ -66,7 +67,6 @@ func (o *GetBucketRetentionConfigParams) BindRequest(r *http.Request, route *mid if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *GetBucketRetentionConfigParams) bindBucketName(rawData []string, hasKey // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/get_bucket_versioning.go b/restapi/operations/user_api/get_bucket_versioning.go index 6563a718f..8e12e65aa 100644 --- a/restapi/operations/user_api/get_bucket_versioning.go +++ b/restapi/operations/user_api/get_bucket_versioning.go @@ -48,7 +48,7 @@ func NewGetBucketVersioning(ctx *middleware.Context, handler GetBucketVersioning return &GetBucketVersioning{Context: ctx, Handler: handler} } -/*GetBucketVersioning swagger:route GET /buckets/{bucket_name}/versioning UserAPI getBucketVersioning +/* GetBucketVersioning swagger:route GET /buckets/{bucket_name}/versioning UserAPI getBucketVersioning Bucket Versioning @@ -61,17 +61,16 @@ type GetBucketVersioning struct { func (o *GetBucketVersioning) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewGetBucketVersioningParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *GetBucketVersioning) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/get_bucket_versioning_parameters.go b/restapi/operations/user_api/get_bucket_versioning_parameters.go index 21c2e145a..2f01c1a84 100644 --- a/restapi/operations/user_api/get_bucket_versioning_parameters.go +++ b/restapi/operations/user_api/get_bucket_versioning_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewGetBucketVersioningParams creates a new GetBucketVersioningParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewGetBucketVersioningParams() GetBucketVersioningParams { return GetBucketVersioningParams{} @@ -66,7 +67,6 @@ func (o *GetBucketVersioningParams) BindRequest(r *http.Request, route *middlewa if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *GetBucketVersioningParams) bindBucketName(rawData []string, hasKey bool // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/has_permission_to.go b/restapi/operations/user_api/has_permission_to.go index 721c1cb15..1c09ea905 100644 --- a/restapi/operations/user_api/has_permission_to.go +++ b/restapi/operations/user_api/has_permission_to.go @@ -48,7 +48,7 @@ func NewHasPermissionTo(ctx *middleware.Context, handler HasPermissionToHandler) return &HasPermissionTo{Context: ctx, Handler: handler} } -/*HasPermissionTo swagger:route POST /has-permission UserAPI hasPermissionTo +/* HasPermissionTo swagger:route POST /has-permission UserAPI hasPermissionTo Checks whether the user can perform a series of actions @@ -61,17 +61,16 @@ type HasPermissionTo struct { func (o *HasPermissionTo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewHasPermissionToParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *HasPermissionTo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/has_permission_to_parameters.go b/restapi/operations/user_api/has_permission_to_parameters.go index a532ee2d4..f90a00d23 100644 --- a/restapi/operations/user_api/has_permission_to_parameters.go +++ b/restapi/operations/user_api/has_permission_to_parameters.go @@ -23,18 +23,21 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewHasPermissionToParams creates a new HasPermissionToParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewHasPermissionToParams() HasPermissionToParams { return HasPermissionToParams{} @@ -80,6 +83,11 @@ func (o *HasPermissionToParams) BindRequest(r *http.Request, route *middleware.M res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/user_api/list_bucket_events.go b/restapi/operations/user_api/list_bucket_events.go index 76f1b2e32..82ac885a1 100644 --- a/restapi/operations/user_api/list_bucket_events.go +++ b/restapi/operations/user_api/list_bucket_events.go @@ -48,7 +48,7 @@ func NewListBucketEvents(ctx *middleware.Context, handler ListBucketEventsHandle return &ListBucketEvents{Context: ctx, Handler: handler} } -/*ListBucketEvents swagger:route GET /buckets/{bucket_name}/events UserAPI listBucketEvents +/* ListBucketEvents swagger:route GET /buckets/{bucket_name}/events UserAPI listBucketEvents List Bucket Events @@ -61,17 +61,16 @@ type ListBucketEvents struct { func (o *ListBucketEvents) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListBucketEventsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListBucketEvents) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/list_bucket_events_parameters.go b/restapi/operations/user_api/list_bucket_events_parameters.go index a544bdb5a..c59bffb0e 100644 --- a/restapi/operations/user_api/list_bucket_events_parameters.go +++ b/restapi/operations/user_api/list_bucket_events_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListBucketEventsParams creates a new ListBucketEventsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListBucketEventsParams() ListBucketEventsParams { return ListBucketEventsParams{} @@ -88,7 +89,6 @@ func (o *ListBucketEventsParams) BindRequest(r *http.Request, route *middleware. if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -104,7 +104,6 @@ func (o *ListBucketEventsParams) bindBucketName(rawData []string, hasKey bool, f // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -119,6 +118,7 @@ func (o *ListBucketEventsParams) bindLimit(rawData []string, hasKey bool, format // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -141,6 +141,7 @@ func (o *ListBucketEventsParams) bindOffset(rawData []string, hasKey bool, forma // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } diff --git a/restapi/operations/user_api/list_buckets.go b/restapi/operations/user_api/list_buckets.go index b099c4f05..77bceeacb 100644 --- a/restapi/operations/user_api/list_buckets.go +++ b/restapi/operations/user_api/list_buckets.go @@ -48,7 +48,7 @@ func NewListBuckets(ctx *middleware.Context, handler ListBucketsHandler) *ListBu return &ListBuckets{Context: ctx, Handler: handler} } -/*ListBuckets swagger:route GET /buckets UserAPI listBuckets +/* ListBuckets swagger:route GET /buckets UserAPI listBuckets List Buckets @@ -61,17 +61,16 @@ type ListBuckets struct { func (o *ListBuckets) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListBucketsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListBuckets) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/list_buckets_parameters.go b/restapi/operations/user_api/list_buckets_parameters.go index d568bfc1a..0da6e5ef0 100644 --- a/restapi/operations/user_api/list_buckets_parameters.go +++ b/restapi/operations/user_api/list_buckets_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListBucketsParams creates a new ListBucketsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListBucketsParams() ListBucketsParams { return ListBucketsParams{} @@ -87,7 +88,6 @@ func (o *ListBucketsParams) BindRequest(r *http.Request, route *middleware.Match if err := o.bindSortBy(qSortBy, qhkSortBy, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -103,6 +103,7 @@ func (o *ListBucketsParams) bindLimit(rawData []string, hasKey bool, formats str // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -125,6 +126,7 @@ func (o *ListBucketsParams) bindOffset(rawData []string, hasKey bool, formats st // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -147,10 +149,10 @@ func (o *ListBucketsParams) bindSortBy(rawData []string, hasKey bool, formats st // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.SortBy = &raw return nil diff --git a/restapi/operations/user_api/list_external_buckets.go b/restapi/operations/user_api/list_external_buckets.go index b09a5d5ac..f05c0ae40 100644 --- a/restapi/operations/user_api/list_external_buckets.go +++ b/restapi/operations/user_api/list_external_buckets.go @@ -48,7 +48,7 @@ func NewListExternalBuckets(ctx *middleware.Context, handler ListExternalBuckets return &ListExternalBuckets{Context: ctx, Handler: handler} } -/*ListExternalBuckets swagger:route POST /list-external-buckets UserAPI listExternalBuckets +/* ListExternalBuckets swagger:route POST /list-external-buckets UserAPI listExternalBuckets Lists an External list of buckets using custom credentials @@ -61,17 +61,16 @@ type ListExternalBuckets struct { func (o *ListExternalBuckets) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListExternalBucketsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListExternalBuckets) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/list_external_buckets_parameters.go b/restapi/operations/user_api/list_external_buckets_parameters.go index 8d16e0b7b..3f8981474 100644 --- a/restapi/operations/user_api/list_external_buckets_parameters.go +++ b/restapi/operations/user_api/list_external_buckets_parameters.go @@ -23,18 +23,21 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewListExternalBucketsParams creates a new ListExternalBucketsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListExternalBucketsParams() ListExternalBucketsParams { return ListExternalBucketsParams{} @@ -80,6 +83,11 @@ func (o *ListExternalBucketsParams) BindRequest(r *http.Request, route *middlewa res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/user_api/list_objects.go b/restapi/operations/user_api/list_objects.go index b9c351f1d..b56f69e4b 100644 --- a/restapi/operations/user_api/list_objects.go +++ b/restapi/operations/user_api/list_objects.go @@ -48,7 +48,7 @@ func NewListObjects(ctx *middleware.Context, handler ListObjectsHandler) *ListOb return &ListObjects{Context: ctx, Handler: handler} } -/*ListObjects swagger:route GET /buckets/{bucket_name}/objects UserAPI listObjects +/* ListObjects swagger:route GET /buckets/{bucket_name}/objects UserAPI listObjects List Objects @@ -61,17 +61,16 @@ type ListObjects struct { func (o *ListObjects) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListObjectsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListObjects) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/list_objects_parameters.go b/restapi/operations/user_api/list_objects_parameters.go index 3058074fa..2701675a5 100644 --- a/restapi/operations/user_api/list_objects_parameters.go +++ b/restapi/operations/user_api/list_objects_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListObjectsParams creates a new ListObjectsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListObjectsParams() ListObjectsParams { return ListObjectsParams{} @@ -97,7 +98,6 @@ func (o *ListObjectsParams) BindRequest(r *http.Request, route *middleware.Match if err := o.bindWithVersions(qWithVersions, qhkWithVersions, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +113,6 @@ func (o *ListObjectsParams) bindBucketName(rawData []string, hasKey bool, format // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -128,10 +127,10 @@ func (o *ListObjectsParams) bindPrefix(rawData []string, hasKey bool, formats st // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.Prefix = &raw return nil @@ -146,6 +145,7 @@ func (o *ListObjectsParams) bindRecursive(rawData []string, hasKey bool, formats // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -168,6 +168,7 @@ func (o *ListObjectsParams) bindWithVersions(rawData []string, hasKey bool, form // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } diff --git a/restapi/operations/user_api/list_remote_buckets.go b/restapi/operations/user_api/list_remote_buckets.go index 895f99ae5..af1db34f2 100644 --- a/restapi/operations/user_api/list_remote_buckets.go +++ b/restapi/operations/user_api/list_remote_buckets.go @@ -48,7 +48,7 @@ func NewListRemoteBuckets(ctx *middleware.Context, handler ListRemoteBucketsHand return &ListRemoteBuckets{Context: ctx, Handler: handler} } -/*ListRemoteBuckets swagger:route GET /remote-buckets UserAPI listRemoteBuckets +/* ListRemoteBuckets swagger:route GET /remote-buckets UserAPI listRemoteBuckets List Remote Buckets @@ -61,17 +61,16 @@ type ListRemoteBuckets struct { func (o *ListRemoteBuckets) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListRemoteBucketsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListRemoteBuckets) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/list_remote_buckets_parameters.go b/restapi/operations/user_api/list_remote_buckets_parameters.go index f0913443c..9a8045aa4 100644 --- a/restapi/operations/user_api/list_remote_buckets_parameters.go +++ b/restapi/operations/user_api/list_remote_buckets_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewListRemoteBucketsParams creates a new ListRemoteBucketsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListRemoteBucketsParams() ListRemoteBucketsParams { return ListRemoteBucketsParams{} diff --git a/restapi/operations/user_api/list_user_service_accounts.go b/restapi/operations/user_api/list_user_service_accounts.go index 9afc1b543..191357be3 100644 --- a/restapi/operations/user_api/list_user_service_accounts.go +++ b/restapi/operations/user_api/list_user_service_accounts.go @@ -48,7 +48,7 @@ func NewListUserServiceAccounts(ctx *middleware.Context, handler ListUserService return &ListUserServiceAccounts{Context: ctx, Handler: handler} } -/*ListUserServiceAccounts swagger:route GET /service-accounts UserAPI listUserServiceAccounts +/* ListUserServiceAccounts swagger:route GET /service-accounts UserAPI listUserServiceAccounts List User's Service Accounts @@ -61,17 +61,16 @@ type ListUserServiceAccounts struct { func (o *ListUserServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewListUserServiceAccountsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ListUserServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Requ } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/list_user_service_accounts_parameters.go b/restapi/operations/user_api/list_user_service_accounts_parameters.go index 7137301d5..3318f3b04 100644 --- a/restapi/operations/user_api/list_user_service_accounts_parameters.go +++ b/restapi/operations/user_api/list_user_service_accounts_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewListUserServiceAccountsParams creates a new ListUserServiceAccountsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewListUserServiceAccountsParams() ListUserServiceAccountsParams { return ListUserServiceAccountsParams{} @@ -78,7 +79,6 @@ func (o *ListUserServiceAccountsParams) BindRequest(r *http.Request, route *midd if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -94,6 +94,7 @@ func (o *ListUserServiceAccountsParams) bindLimit(rawData []string, hasKey bool, // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } @@ -116,6 +117,7 @@ func (o *ListUserServiceAccountsParams) bindOffset(rawData []string, hasKey bool // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } diff --git a/restapi/operations/user_api/log_search.go b/restapi/operations/user_api/log_search.go index 0e39cfba6..650bc4915 100644 --- a/restapi/operations/user_api/log_search.go +++ b/restapi/operations/user_api/log_search.go @@ -48,7 +48,7 @@ func NewLogSearch(ctx *middleware.Context, handler LogSearchHandler) *LogSearch return &LogSearch{Context: ctx, Handler: handler} } -/*LogSearch swagger:route GET /logs/search UserAPI logSearch +/* LogSearch swagger:route GET /logs/search UserAPI logSearch Search the logs @@ -61,17 +61,16 @@ type LogSearch struct { func (o *LogSearch) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewLogSearchParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *LogSearch) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/log_search_parameters.go b/restapi/operations/user_api/log_search_parameters.go index 8962cf7b5..6a7a4bd5d 100644 --- a/restapi/operations/user_api/log_search_parameters.go +++ b/restapi/operations/user_api/log_search_parameters.go @@ -124,7 +124,6 @@ func (o *LogSearchParams) BindRequest(r *http.Request, route *middleware.Matched if err := o.bindTimeStart(qTimeStart, qhkTimeStart, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -135,10 +134,8 @@ func (o *LogSearchParams) BindRequest(r *http.Request, route *middleware.Matched // // Arrays are parsed according to CollectionFormat: "multi" (defaults to "csv" when empty). func (o *LogSearchParams) bindFp(rawData []string, hasKey bool, formats strfmt.Registry) error { - // CollectionFormat: multi fpIC := rawData - if len(fpIC) == 0 { return nil } @@ -164,11 +161,11 @@ func (o *LogSearchParams) bindOrder(rawData []string, hasKey bool, formats strfm // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations // Default values have been previously initialized by NewLogSearchParams() return nil } - o.Order = &raw if err := o.validateOrder(formats); err != nil { @@ -197,6 +194,7 @@ func (o *LogSearchParams) bindPageNo(rawData []string, hasKey bool, formats strf // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations // Default values have been previously initialized by NewLogSearchParams() return nil @@ -220,6 +218,7 @@ func (o *LogSearchParams) bindPageSize(rawData []string, hasKey bool, formats st // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations // Default values have been previously initialized by NewLogSearchParams() return nil @@ -243,10 +242,10 @@ func (o *LogSearchParams) bindTimeStart(rawData []string, hasKey bool, formats s // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.TimeStart = &raw return nil diff --git a/restapi/operations/user_api/login.go b/restapi/operations/user_api/login.go index 0a3fc953f..e8097a987 100644 --- a/restapi/operations/user_api/login.go +++ b/restapi/operations/user_api/login.go @@ -46,7 +46,7 @@ func NewLogin(ctx *middleware.Context, handler LoginHandler) *Login { return &Login{Context: ctx, Handler: handler} } -/*Login swagger:route POST /login UserAPI login +/* Login swagger:route POST /login UserAPI login Login to Console @@ -59,17 +59,15 @@ type Login struct { func (o *Login) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewLoginParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params o.Context.Respond(rw, r, route.Produces, route, err) return } res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/login_detail.go b/restapi/operations/user_api/login_detail.go index 62839edce..2b69099f3 100644 --- a/restapi/operations/user_api/login_detail.go +++ b/restapi/operations/user_api/login_detail.go @@ -46,7 +46,7 @@ func NewLoginDetail(ctx *middleware.Context, handler LoginDetailHandler) *LoginD return &LoginDetail{Context: ctx, Handler: handler} } -/*LoginDetail swagger:route GET /login UserAPI loginDetail +/* LoginDetail swagger:route GET /login UserAPI loginDetail Returns login strategy, form or sso. @@ -59,17 +59,15 @@ type LoginDetail struct { func (o *LoginDetail) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewLoginDetailParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params o.Context.Respond(rw, r, route.Produces, route, err) return } res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/login_detail_parameters.go b/restapi/operations/user_api/login_detail_parameters.go index 880aac545..0a9ec9b19 100644 --- a/restapi/operations/user_api/login_detail_parameters.go +++ b/restapi/operations/user_api/login_detail_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewLoginDetailParams creates a new LoginDetailParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewLoginDetailParams() LoginDetailParams { return LoginDetailParams{} diff --git a/restapi/operations/user_api/login_oauth2_auth.go b/restapi/operations/user_api/login_oauth2_auth.go index a0d7e294d..7713d8f4c 100644 --- a/restapi/operations/user_api/login_oauth2_auth.go +++ b/restapi/operations/user_api/login_oauth2_auth.go @@ -46,7 +46,7 @@ func NewLoginOauth2Auth(ctx *middleware.Context, handler LoginOauth2AuthHandler) return &LoginOauth2Auth{Context: ctx, Handler: handler} } -/*LoginOauth2Auth swagger:route POST /login/oauth2/auth UserAPI loginOauth2Auth +/* LoginOauth2Auth swagger:route POST /login/oauth2/auth UserAPI loginOauth2Auth Identity Provider oauth2 callback endpoint. @@ -59,17 +59,15 @@ type LoginOauth2Auth struct { func (o *LoginOauth2Auth) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewLoginOauth2AuthParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params o.Context.Respond(rw, r, route.Produces, route, err) return } res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/login_oauth2_auth_parameters.go b/restapi/operations/user_api/login_oauth2_auth_parameters.go index f4330c2c7..2ec622777 100644 --- a/restapi/operations/user_api/login_oauth2_auth_parameters.go +++ b/restapi/operations/user_api/login_oauth2_auth_parameters.go @@ -23,18 +23,21 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewLoginOauth2AuthParams creates a new LoginOauth2AuthParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewLoginOauth2AuthParams() LoginOauth2AuthParams { return LoginOauth2AuthParams{} @@ -80,6 +83,11 @@ func (o *LoginOauth2AuthParams) BindRequest(r *http.Request, route *middleware.M res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/user_api/login_operator.go b/restapi/operations/user_api/login_operator.go index 998066c0e..b5ae3c4a6 100644 --- a/restapi/operations/user_api/login_operator.go +++ b/restapi/operations/user_api/login_operator.go @@ -46,7 +46,7 @@ func NewLoginOperator(ctx *middleware.Context, handler LoginOperatorHandler) *Lo return &LoginOperator{Context: ctx, Handler: handler} } -/*LoginOperator swagger:route POST /login/operator UserAPI loginOperator +/* LoginOperator swagger:route POST /login/operator UserAPI loginOperator Login to Operator Console. @@ -59,17 +59,15 @@ type LoginOperator struct { func (o *LoginOperator) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewLoginOperatorParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params o.Context.Respond(rw, r, route.Produces, route, err) return } res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/login_operator_parameters.go b/restapi/operations/user_api/login_operator_parameters.go index 3240f2de0..beaf64f27 100644 --- a/restapi/operations/user_api/login_operator_parameters.go +++ b/restapi/operations/user_api/login_operator_parameters.go @@ -23,18 +23,21 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewLoginOperatorParams creates a new LoginOperatorParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewLoginOperatorParams() LoginOperatorParams { return LoginOperatorParams{} @@ -80,6 +83,11 @@ func (o *LoginOperatorParams) BindRequest(r *http.Request, route *middleware.Mat res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/user_api/login_parameters.go b/restapi/operations/user_api/login_parameters.go index 5f9e8b447..82b4ae00c 100644 --- a/restapi/operations/user_api/login_parameters.go +++ b/restapi/operations/user_api/login_parameters.go @@ -23,18 +23,21 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewLoginParams creates a new LoginParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewLoginParams() LoginParams { return LoginParams{} @@ -80,6 +83,11 @@ func (o *LoginParams) BindRequest(r *http.Request, route *middleware.MatchedRout res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/user_api/logout.go b/restapi/operations/user_api/logout.go index cc37d9653..ad4b10d4a 100644 --- a/restapi/operations/user_api/logout.go +++ b/restapi/operations/user_api/logout.go @@ -48,7 +48,7 @@ func NewLogout(ctx *middleware.Context, handler LogoutHandler) *Logout { return &Logout{Context: ctx, Handler: handler} } -/*Logout swagger:route POST /logout UserAPI logout +/* Logout swagger:route POST /logout UserAPI logout Logout from Console. @@ -61,17 +61,16 @@ type Logout struct { func (o *Logout) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewLogoutParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *Logout) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/logout_parameters.go b/restapi/operations/user_api/logout_parameters.go index 95e6bdfaf..f292177f8 100644 --- a/restapi/operations/user_api/logout_parameters.go +++ b/restapi/operations/user_api/logout_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewLogoutParams creates a new LogoutParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewLogoutParams() LogoutParams { return LogoutParams{} diff --git a/restapi/operations/user_api/make_bucket.go b/restapi/operations/user_api/make_bucket.go index 6f4e2344c..8595c2cde 100644 --- a/restapi/operations/user_api/make_bucket.go +++ b/restapi/operations/user_api/make_bucket.go @@ -48,7 +48,7 @@ func NewMakeBucket(ctx *middleware.Context, handler MakeBucketHandler) *MakeBuck return &MakeBucket{Context: ctx, Handler: handler} } -/*MakeBucket swagger:route POST /buckets UserAPI makeBucket +/* MakeBucket swagger:route POST /buckets UserAPI makeBucket Make bucket @@ -61,17 +61,16 @@ type MakeBucket struct { func (o *MakeBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewMakeBucketParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *MakeBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/make_bucket_parameters.go b/restapi/operations/user_api/make_bucket_parameters.go index a7af20cf7..b99137d6b 100644 --- a/restapi/operations/user_api/make_bucket_parameters.go +++ b/restapi/operations/user_api/make_bucket_parameters.go @@ -23,18 +23,21 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewMakeBucketParams creates a new MakeBucketParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewMakeBucketParams() MakeBucketParams { return MakeBucketParams{} @@ -80,6 +83,11 @@ func (o *MakeBucketParams) BindRequest(r *http.Request, route *middleware.Matche res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/user_api/post_buckets_bucket_name_objects_upload.go b/restapi/operations/user_api/post_buckets_bucket_name_objects_upload.go index 14cbf2f78..2cffc6938 100644 --- a/restapi/operations/user_api/post_buckets_bucket_name_objects_upload.go +++ b/restapi/operations/user_api/post_buckets_bucket_name_objects_upload.go @@ -48,7 +48,7 @@ func NewPostBucketsBucketNameObjectsUpload(ctx *middleware.Context, handler Post return &PostBucketsBucketNameObjectsUpload{Context: ctx, Handler: handler} } -/*PostBucketsBucketNameObjectsUpload swagger:route POST /buckets/{bucket_name}/objects/upload UserAPI postBucketsBucketNameObjectsUpload +/* PostBucketsBucketNameObjectsUpload swagger:route POST /buckets/{bucket_name}/objects/upload UserAPI postBucketsBucketNameObjectsUpload Uploads an Object. @@ -61,17 +61,16 @@ type PostBucketsBucketNameObjectsUpload struct { func (o *PostBucketsBucketNameObjectsUpload) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewPostBucketsBucketNameObjectsUploadParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *PostBucketsBucketNameObjectsUpload) ServeHTTP(rw http.ResponseWriter, r } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/post_buckets_bucket_name_objects_upload_parameters.go b/restapi/operations/user_api/post_buckets_bucket_name_objects_upload_parameters.go index ee45c5ad9..627987610 100644 --- a/restapi/operations/user_api/post_buckets_bucket_name_objects_upload_parameters.go +++ b/restapi/operations/user_api/post_buckets_bucket_name_objects_upload_parameters.go @@ -32,7 +32,8 @@ import ( ) // NewPostBucketsBucketNameObjectsUploadParams creates a new PostBucketsBucketNameObjectsUploadParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewPostBucketsBucketNameObjectsUploadParams() PostBucketsBucketNameObjectsUploadParams { return PostBucketsBucketNameObjectsUploadParams{} @@ -78,7 +79,6 @@ func (o *PostBucketsBucketNameObjectsUploadParams) BindRequest(r *http.Request, if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -94,7 +94,6 @@ func (o *PostBucketsBucketNameObjectsUploadParams) bindBucketName(rawData []stri // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -109,10 +108,10 @@ func (o *PostBucketsBucketNameObjectsUploadParams) bindPrefix(rawData []string, // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.Prefix = &raw return nil diff --git a/restapi/operations/user_api/put_object_legal_hold.go b/restapi/operations/user_api/put_object_legal_hold.go index 15c9546f2..960b443fe 100644 --- a/restapi/operations/user_api/put_object_legal_hold.go +++ b/restapi/operations/user_api/put_object_legal_hold.go @@ -48,7 +48,7 @@ func NewPutObjectLegalHold(ctx *middleware.Context, handler PutObjectLegalHoldHa return &PutObjectLegalHold{Context: ctx, Handler: handler} } -/*PutObjectLegalHold swagger:route PUT /buckets/{bucket_name}/objects/legalhold UserAPI putObjectLegalHold +/* PutObjectLegalHold swagger:route PUT /buckets/{bucket_name}/objects/legalhold UserAPI putObjectLegalHold Put Object's legalhold status @@ -61,17 +61,16 @@ type PutObjectLegalHold struct { func (o *PutObjectLegalHold) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewPutObjectLegalHoldParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *PutObjectLegalHold) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/put_object_legal_hold_parameters.go b/restapi/operations/user_api/put_object_legal_hold_parameters.go index 2fe5efdbd..a5d416ee7 100644 --- a/restapi/operations/user_api/put_object_legal_hold_parameters.go +++ b/restapi/operations/user_api/put_object_legal_hold_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -36,7 +37,8 @@ import ( ) // NewPutObjectLegalHoldParams creates a new PutObjectLegalHoldParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewPutObjectLegalHoldParams() PutObjectLegalHoldParams { return PutObjectLegalHoldParams{} @@ -99,6 +101,11 @@ func (o *PutObjectLegalHoldParams) BindRequest(r *http.Request, route *middlewar res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -106,6 +113,7 @@ func (o *PutObjectLegalHoldParams) BindRequest(r *http.Request, route *middlewar } else { res = append(res, errors.Required("body", "body", "")) } + rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) @@ -120,7 +128,6 @@ func (o *PutObjectLegalHoldParams) BindRequest(r *http.Request, route *middlewar if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -136,7 +143,6 @@ func (o *PutObjectLegalHoldParams) bindBucketName(rawData []string, hasKey bool, // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -154,10 +160,10 @@ func (o *PutObjectLegalHoldParams) bindPrefix(rawData []string, hasKey bool, for // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } - o.Prefix = raw return nil @@ -175,10 +181,10 @@ func (o *PutObjectLegalHoldParams) bindVersionID(rawData []string, hasKey bool, // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("version_id", "query", raw); err != nil { return err } - o.VersionID = raw return nil diff --git a/restapi/operations/user_api/put_object_retention.go b/restapi/operations/user_api/put_object_retention.go index f46bf40f4..1d0227c9c 100644 --- a/restapi/operations/user_api/put_object_retention.go +++ b/restapi/operations/user_api/put_object_retention.go @@ -48,7 +48,7 @@ func NewPutObjectRetention(ctx *middleware.Context, handler PutObjectRetentionHa return &PutObjectRetention{Context: ctx, Handler: handler} } -/*PutObjectRetention swagger:route PUT /buckets/{bucket_name}/objects/retention UserAPI putObjectRetention +/* PutObjectRetention swagger:route PUT /buckets/{bucket_name}/objects/retention UserAPI putObjectRetention Put Object's retention status @@ -61,17 +61,16 @@ type PutObjectRetention struct { func (o *PutObjectRetention) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewPutObjectRetentionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *PutObjectRetention) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/put_object_retention_parameters.go b/restapi/operations/user_api/put_object_retention_parameters.go index 8fa9985d3..88ea35d16 100644 --- a/restapi/operations/user_api/put_object_retention_parameters.go +++ b/restapi/operations/user_api/put_object_retention_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -36,7 +37,8 @@ import ( ) // NewPutObjectRetentionParams creates a new PutObjectRetentionParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewPutObjectRetentionParams() PutObjectRetentionParams { return PutObjectRetentionParams{} @@ -99,6 +101,11 @@ func (o *PutObjectRetentionParams) BindRequest(r *http.Request, route *middlewar res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -106,6 +113,7 @@ func (o *PutObjectRetentionParams) BindRequest(r *http.Request, route *middlewar } else { res = append(res, errors.Required("body", "body", "")) } + rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) @@ -120,7 +128,6 @@ func (o *PutObjectRetentionParams) BindRequest(r *http.Request, route *middlewar if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -136,7 +143,6 @@ func (o *PutObjectRetentionParams) bindBucketName(rawData []string, hasKey bool, // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -154,10 +160,10 @@ func (o *PutObjectRetentionParams) bindPrefix(rawData []string, hasKey bool, for // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } - o.Prefix = raw return nil @@ -175,10 +181,10 @@ func (o *PutObjectRetentionParams) bindVersionID(rawData []string, hasKey bool, // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("version_id", "query", raw); err != nil { return err } - o.VersionID = raw return nil diff --git a/restapi/operations/user_api/put_object_tags.go b/restapi/operations/user_api/put_object_tags.go index b53d295d4..92c20b209 100644 --- a/restapi/operations/user_api/put_object_tags.go +++ b/restapi/operations/user_api/put_object_tags.go @@ -48,7 +48,7 @@ func NewPutObjectTags(ctx *middleware.Context, handler PutObjectTagsHandler) *Pu return &PutObjectTags{Context: ctx, Handler: handler} } -/*PutObjectTags swagger:route PUT /buckets/{bucket_name}/objects/tags UserAPI putObjectTags +/* PutObjectTags swagger:route PUT /buckets/{bucket_name}/objects/tags UserAPI putObjectTags Put Object's tags @@ -61,17 +61,16 @@ type PutObjectTags struct { func (o *PutObjectTags) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewPutObjectTagsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *PutObjectTags) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/put_object_tags_parameters.go b/restapi/operations/user_api/put_object_tags_parameters.go index f6342c0b5..9c13fc8c2 100644 --- a/restapi/operations/user_api/put_object_tags_parameters.go +++ b/restapi/operations/user_api/put_object_tags_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -36,7 +37,8 @@ import ( ) // NewPutObjectTagsParams creates a new PutObjectTagsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewPutObjectTagsParams() PutObjectTagsParams { return PutObjectTagsParams{} @@ -99,6 +101,11 @@ func (o *PutObjectTagsParams) BindRequest(r *http.Request, route *middleware.Mat res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -106,6 +113,7 @@ func (o *PutObjectTagsParams) BindRequest(r *http.Request, route *middleware.Mat } else { res = append(res, errors.Required("body", "body", "")) } + rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) @@ -120,7 +128,6 @@ func (o *PutObjectTagsParams) BindRequest(r *http.Request, route *middleware.Mat if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -136,7 +143,6 @@ func (o *PutObjectTagsParams) bindBucketName(rawData []string, hasKey bool, form // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -154,10 +160,10 @@ func (o *PutObjectTagsParams) bindPrefix(rawData []string, hasKey bool, formats // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } - o.Prefix = raw return nil @@ -175,10 +181,10 @@ func (o *PutObjectTagsParams) bindVersionID(rawData []string, hasKey bool, forma // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("version_id", "query", raw); err != nil { return err } - o.VersionID = raw return nil diff --git a/restapi/operations/user_api/remote_bucket_details.go b/restapi/operations/user_api/remote_bucket_details.go index 27a1cfbe6..4442ce710 100644 --- a/restapi/operations/user_api/remote_bucket_details.go +++ b/restapi/operations/user_api/remote_bucket_details.go @@ -48,7 +48,7 @@ func NewRemoteBucketDetails(ctx *middleware.Context, handler RemoteBucketDetails return &RemoteBucketDetails{Context: ctx, Handler: handler} } -/*RemoteBucketDetails swagger:route GET /remote-buckets/{name} UserAPI remoteBucketDetails +/* RemoteBucketDetails swagger:route GET /remote-buckets/{name} UserAPI remoteBucketDetails Remote Bucket Details @@ -61,17 +61,16 @@ type RemoteBucketDetails struct { func (o *RemoteBucketDetails) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewRemoteBucketDetailsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *RemoteBucketDetails) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/remote_bucket_details_parameters.go b/restapi/operations/user_api/remote_bucket_details_parameters.go index fea31b115..a38b35f61 100644 --- a/restapi/operations/user_api/remote_bucket_details_parameters.go +++ b/restapi/operations/user_api/remote_bucket_details_parameters.go @@ -31,7 +31,8 @@ import ( ) // NewRemoteBucketDetailsParams creates a new RemoteBucketDetailsParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewRemoteBucketDetailsParams() RemoteBucketDetailsParams { return RemoteBucketDetailsParams{} @@ -66,7 +67,6 @@ func (o *RemoteBucketDetailsParams) BindRequest(r *http.Request, route *middlewa if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,7 +82,6 @@ func (o *RemoteBucketDetailsParams) bindName(rawData []string, hasKey bool, form // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/user_api/session_check.go b/restapi/operations/user_api/session_check.go index 59be0ebce..dbfeb429b 100644 --- a/restapi/operations/user_api/session_check.go +++ b/restapi/operations/user_api/session_check.go @@ -48,7 +48,7 @@ func NewSessionCheck(ctx *middleware.Context, handler SessionCheckHandler) *Sess return &SessionCheck{Context: ctx, Handler: handler} } -/*SessionCheck swagger:route GET /session UserAPI sessionCheck +/* SessionCheck swagger:route GET /session UserAPI sessionCheck Endpoint to check if your session is still valid @@ -61,17 +61,16 @@ type SessionCheck struct { func (o *SessionCheck) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSessionCheckParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SessionCheck) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/session_check_parameters.go b/restapi/operations/user_api/session_check_parameters.go index 796425716..5f3eaaac4 100644 --- a/restapi/operations/user_api/session_check_parameters.go +++ b/restapi/operations/user_api/session_check_parameters.go @@ -30,7 +30,8 @@ import ( ) // NewSessionCheckParams creates a new SessionCheckParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSessionCheckParams() SessionCheckParams { return SessionCheckParams{} diff --git a/restapi/operations/user_api/set_bucket_quota.go b/restapi/operations/user_api/set_bucket_quota.go index 68046a9e4..1d009e513 100644 --- a/restapi/operations/user_api/set_bucket_quota.go +++ b/restapi/operations/user_api/set_bucket_quota.go @@ -48,7 +48,7 @@ func NewSetBucketQuota(ctx *middleware.Context, handler SetBucketQuotaHandler) * return &SetBucketQuota{Context: ctx, Handler: handler} } -/*SetBucketQuota swagger:route PUT /buckets/{name}/quota UserAPI setBucketQuota +/* SetBucketQuota swagger:route PUT /buckets/{name}/quota UserAPI setBucketQuota Bucket Quota @@ -61,17 +61,16 @@ type SetBucketQuota struct { func (o *SetBucketQuota) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSetBucketQuotaParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SetBucketQuota) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/set_bucket_quota_parameters.go b/restapi/operations/user_api/set_bucket_quota_parameters.go index 5c747aadb..3ef2ace76 100644 --- a/restapi/operations/user_api/set_bucket_quota_parameters.go +++ b/restapi/operations/user_api/set_bucket_quota_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewSetBucketQuotaParams creates a new SetBucketQuotaParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSetBucketQuotaParams() SetBucketQuotaParams { return SetBucketQuotaParams{} @@ -86,6 +89,11 @@ func (o *SetBucketQuotaParams) BindRequest(r *http.Request, route *middleware.Ma res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *SetBucketQuotaParams) BindRequest(r *http.Request, route *middleware.Ma } else { res = append(res, errors.Required("body", "body", "")) } + rName, rhkName, _ := route.Params.GetOK("name") if err := o.bindName(rName, rhkName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *SetBucketQuotaParams) bindName(rawData []string, hasKey bool, formats s // Required: true // Parameter is provided by construction from the route - o.Name = raw return nil diff --git a/restapi/operations/user_api/set_bucket_retention_config.go b/restapi/operations/user_api/set_bucket_retention_config.go index d8435d9ed..93ce18d09 100644 --- a/restapi/operations/user_api/set_bucket_retention_config.go +++ b/restapi/operations/user_api/set_bucket_retention_config.go @@ -48,7 +48,7 @@ func NewSetBucketRetentionConfig(ctx *middleware.Context, handler SetBucketReten return &SetBucketRetentionConfig{Context: ctx, Handler: handler} } -/*SetBucketRetentionConfig swagger:route PUT /buckets/{bucket_name}/retention UserAPI setBucketRetentionConfig +/* SetBucketRetentionConfig swagger:route PUT /buckets/{bucket_name}/retention UserAPI setBucketRetentionConfig Set Bucket's retention config @@ -61,17 +61,16 @@ type SetBucketRetentionConfig struct { func (o *SetBucketRetentionConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSetBucketRetentionConfigParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SetBucketRetentionConfig) ServeHTTP(rw http.ResponseWriter, r *http.Req } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/set_bucket_retention_config_parameters.go b/restapi/operations/user_api/set_bucket_retention_config_parameters.go index dd3a42bda..71c57347c 100644 --- a/restapi/operations/user_api/set_bucket_retention_config_parameters.go +++ b/restapi/operations/user_api/set_bucket_retention_config_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewSetBucketRetentionConfigParams creates a new SetBucketRetentionConfigParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSetBucketRetentionConfigParams() SetBucketRetentionConfigParams { return SetBucketRetentionConfigParams{} @@ -86,6 +89,11 @@ func (o *SetBucketRetentionConfigParams) BindRequest(r *http.Request, route *mid res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *SetBucketRetentionConfigParams) BindRequest(r *http.Request, route *mid } else { res = append(res, errors.Required("body", "body", "")) } + rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *SetBucketRetentionConfigParams) bindBucketName(rawData []string, hasKey // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/set_bucket_versioning.go b/restapi/operations/user_api/set_bucket_versioning.go index 77fa62296..430fc06c2 100644 --- a/restapi/operations/user_api/set_bucket_versioning.go +++ b/restapi/operations/user_api/set_bucket_versioning.go @@ -48,7 +48,7 @@ func NewSetBucketVersioning(ctx *middleware.Context, handler SetBucketVersioning return &SetBucketVersioning{Context: ctx, Handler: handler} } -/*SetBucketVersioning swagger:route PUT /buckets/{bucket_name}/versioning UserAPI setBucketVersioning +/* SetBucketVersioning swagger:route PUT /buckets/{bucket_name}/versioning UserAPI setBucketVersioning Set Bucket Versioning @@ -61,17 +61,16 @@ type SetBucketVersioning struct { func (o *SetBucketVersioning) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSetBucketVersioningParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SetBucketVersioning) ServeHTTP(rw http.ResponseWriter, r *http.Request) } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/set_bucket_versioning_parameters.go b/restapi/operations/user_api/set_bucket_versioning_parameters.go index 26d0412e6..a75c04db7 100644 --- a/restapi/operations/user_api/set_bucket_versioning_parameters.go +++ b/restapi/operations/user_api/set_bucket_versioning_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewSetBucketVersioningParams creates a new SetBucketVersioningParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSetBucketVersioningParams() SetBucketVersioningParams { return SetBucketVersioningParams{} @@ -86,6 +89,11 @@ func (o *SetBucketVersioningParams) BindRequest(r *http.Request, route *middlewa res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -93,11 +101,11 @@ func (o *SetBucketVersioningParams) BindRequest(r *http.Request, route *middlewa } else { res = append(res, errors.Required("body", "body", "")) } + rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -113,7 +121,6 @@ func (o *SetBucketVersioningParams) bindBucketName(rawData []string, hasKey bool // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil diff --git a/restapi/operations/user_api/set_multi_bucket_replication.go b/restapi/operations/user_api/set_multi_bucket_replication.go index 91480ec2a..85e8fc3c2 100644 --- a/restapi/operations/user_api/set_multi_bucket_replication.go +++ b/restapi/operations/user_api/set_multi_bucket_replication.go @@ -48,7 +48,7 @@ func NewSetMultiBucketReplication(ctx *middleware.Context, handler SetMultiBucke return &SetMultiBucketReplication{Context: ctx, Handler: handler} } -/*SetMultiBucketReplication swagger:route POST /buckets-replication UserAPI setMultiBucketReplication +/* SetMultiBucketReplication swagger:route POST /buckets-replication UserAPI setMultiBucketReplication Sets Multi Bucket Replication in multiple Buckets @@ -61,17 +61,16 @@ type SetMultiBucketReplication struct { func (o *SetMultiBucketReplication) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewSetMultiBucketReplicationParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *SetMultiBucketReplication) ServeHTTP(rw http.ResponseWriter, r *http.Re } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/set_multi_bucket_replication_parameters.go b/restapi/operations/user_api/set_multi_bucket_replication_parameters.go index 7a74a09e8..1341ce457 100644 --- a/restapi/operations/user_api/set_multi_bucket_replication_parameters.go +++ b/restapi/operations/user_api/set_multi_bucket_replication_parameters.go @@ -23,18 +23,21 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewSetMultiBucketReplicationParams creates a new SetMultiBucketReplicationParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewSetMultiBucketReplicationParams() SetMultiBucketReplicationParams { return SetMultiBucketReplicationParams{} @@ -80,6 +83,11 @@ func (o *SetMultiBucketReplicationParams) BindRequest(r *http.Request, route *mi res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } diff --git a/restapi/operations/user_api/share_object.go b/restapi/operations/user_api/share_object.go index 00d1d666c..a2bcecf3c 100644 --- a/restapi/operations/user_api/share_object.go +++ b/restapi/operations/user_api/share_object.go @@ -48,7 +48,7 @@ func NewShareObject(ctx *middleware.Context, handler ShareObjectHandler) *ShareO return &ShareObject{Context: ctx, Handler: handler} } -/*ShareObject swagger:route GET /buckets/{bucket_name}/objects/share UserAPI shareObject +/* ShareObject swagger:route GET /buckets/{bucket_name}/objects/share UserAPI shareObject Shares an Object on a url @@ -61,17 +61,16 @@ type ShareObject struct { func (o *ShareObject) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewShareObjectParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *ShareObject) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/share_object_parameters.go b/restapi/operations/user_api/share_object_parameters.go index 26e7ffa96..2506b1c76 100644 --- a/restapi/operations/user_api/share_object_parameters.go +++ b/restapi/operations/user_api/share_object_parameters.go @@ -33,7 +33,8 @@ import ( ) // NewShareObjectParams creates a new ShareObjectParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewShareObjectParams() ShareObjectParams { return ShareObjectParams{} @@ -99,7 +100,6 @@ func (o *ShareObjectParams) BindRequest(r *http.Request, route *middleware.Match if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -115,7 +115,6 @@ func (o *ShareObjectParams) bindBucketName(rawData []string, hasKey bool, format // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -130,10 +129,10 @@ func (o *ShareObjectParams) bindExpires(rawData []string, hasKey bool, formats s // Required: false // AllowEmptyValue: false + if raw == "" { // empty values pass all other validations return nil } - o.Expires = &raw return nil @@ -151,10 +150,10 @@ func (o *ShareObjectParams) bindPrefix(rawData []string, hasKey bool, formats st // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("prefix", "query", raw); err != nil { return err } - o.Prefix = raw return nil @@ -172,10 +171,10 @@ func (o *ShareObjectParams) bindVersionID(rawData []string, hasKey bool, formats // Required: true // AllowEmptyValue: false + if err := validate.RequiredString("version_id", "query", raw); err != nil { return err } - o.VersionID = raw return nil diff --git a/restapi/operations/user_api/update_bucket_lifecycle.go b/restapi/operations/user_api/update_bucket_lifecycle.go index eec6c3d92..fabb63f51 100644 --- a/restapi/operations/user_api/update_bucket_lifecycle.go +++ b/restapi/operations/user_api/update_bucket_lifecycle.go @@ -48,7 +48,7 @@ func NewUpdateBucketLifecycle(ctx *middleware.Context, handler UpdateBucketLifec return &UpdateBucketLifecycle{Context: ctx, Handler: handler} } -/*UpdateBucketLifecycle swagger:route PUT /buckets/{bucket_name}/lifecycle/{lifecycle_id} UserAPI updateBucketLifecycle +/* UpdateBucketLifecycle swagger:route PUT /buckets/{bucket_name}/lifecycle/{lifecycle_id} UserAPI updateBucketLifecycle Update Lifecycle rule @@ -61,17 +61,16 @@ type UpdateBucketLifecycle struct { func (o *UpdateBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { - r = rCtx + *r = *rCtx } var Params = NewUpdateBucketLifecycleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) return } if aCtx != nil { - r = aCtx + *r = *aCtx } var principal *models.Principal if uprinc != nil { @@ -84,7 +83,6 @@ func (o *UpdateBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Reques } res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) } diff --git a/restapi/operations/user_api/update_bucket_lifecycle_parameters.go b/restapi/operations/user_api/update_bucket_lifecycle_parameters.go index 81a2220e8..b7053a35d 100644 --- a/restapi/operations/user_api/update_bucket_lifecycle_parameters.go +++ b/restapi/operations/user_api/update_bucket_lifecycle_parameters.go @@ -23,6 +23,7 @@ package user_api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "io" "net/http" @@ -30,12 +31,14 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" "github.com/minio/console/models" ) // NewUpdateBucketLifecycleParams creates a new UpdateBucketLifecycleParams object -// no default values defined in spec. +// +// There are no default values defined in the spec. func NewUpdateBucketLifecycleParams() UpdateBucketLifecycleParams { return UpdateBucketLifecycleParams{} @@ -91,6 +94,11 @@ func (o *UpdateBucketLifecycleParams) BindRequest(r *http.Request, route *middle res = append(res, err) } + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + if len(res) == 0 { o.Body = &body } @@ -98,6 +106,7 @@ func (o *UpdateBucketLifecycleParams) BindRequest(r *http.Request, route *middle } else { res = append(res, errors.Required("body", "body", "")) } + rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { res = append(res, err) @@ -107,7 +116,6 @@ func (o *UpdateBucketLifecycleParams) BindRequest(r *http.Request, route *middle if err := o.bindLifecycleID(rLifecycleID, rhkLifecycleID, route.Formats); err != nil { res = append(res, err) } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -123,7 +131,6 @@ func (o *UpdateBucketLifecycleParams) bindBucketName(rawData []string, hasKey bo // Required: true // Parameter is provided by construction from the route - o.BucketName = raw return nil @@ -138,7 +145,6 @@ func (o *UpdateBucketLifecycleParams) bindLifecycleID(rawData []string, hasKey b // Required: true // Parameter is provided by construction from the route - o.LifecycleID = raw return nil diff --git a/restapi/user_buckets.go b/restapi/user_buckets.go index e0cc01540..744698a67 100644 --- a/restapi/user_buckets.go +++ b/restapi/user_buckets.go @@ -378,7 +378,7 @@ func getMakeBucketResponse(session *models.Principal, br *models.MakeBucketReque // Set Bucket Retention Configuration if defined if br.Retention != nil { - err = setBucketRetentionConfig(ctx, minioClient, *br.Name, br.Retention.Mode, br.Retention.Unit, br.Retention.Validity) + err = setBucketRetentionConfig(ctx, minioClient, *br.Name, *br.Retention.Mode, *br.Retention.Unit, br.Retention.Validity) if err != nil { return prepareError(err) } @@ -429,7 +429,7 @@ func getBucketSetPolicyResponse(session *models.Principal, bucketName string, re minioClient := minioClient{client: mClient} // set bucket access policy - if err := setBucketAccessPolicy(ctx, minioClient, bucketName, req.Access); err != nil { + if err := setBucketAccessPolicy(ctx, minioClient, bucketName, *req.Access); err != nil { return nil, prepareError(err) } // get updated bucket details and return it @@ -487,7 +487,7 @@ func getBucketInfo(client MinioClient, bucketName string) (*models.Bucket, error } bucket := &models.Bucket{ Name: &bucketName, - Access: bucketAccess, + Access: &bucketAccess, CreationDate: "", // to be implemented Size: 0, // to be implemented } @@ -540,9 +540,9 @@ func consoleAccess2policyAccess(bucketAccess models.BucketAccess) (bucketPolicy func enableBucketEncryption(ctx context.Context, client MinioClient, bucketName string, encryptionType models.BucketEncryptionType, kmsKeyID string) error { var config *sse.Configuration switch encryptionType { - case models.BucketEncryptionTypeSseKms: + case models.BucketEncryptionTypeSseDashKms: config = sse.NewConfigurationSSEKMS(kmsKeyID) - case models.BucketEncryptionTypeSseS3: + case models.BucketEncryptionTypeSseDashS3: config = sse.NewConfigurationSSES3() default: return errInvalidEncryptionAlgorithm @@ -561,7 +561,7 @@ func enableBucketEncryptionResponse(session *models.Principal, params user_api.E // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} - if err := enableBucketEncryption(ctx, minioClient, params.BucketName, params.Body.EncType, params.Body.KmsKeyID); err != nil { + if err := enableBucketEncryption(ctx, minioClient, params.BucketName, *params.Body.EncType, params.Body.KmsKeyID); err != nil { return prepareError(err) } return nil @@ -657,8 +657,7 @@ func getSetBucketRetentionConfigResponse(session *models.Principal, params user_ // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} - - err = setBucketRetentionConfig(ctx, minioClient, params.BucketName, params.Body.Mode, params.Body.Unit, params.Body.Validity) + err = setBucketRetentionConfig(ctx, minioClient, params.BucketName, *params.Body.Mode, *params.Body.Unit, params.Body.Validity) if err != nil { return prepareError(err) } diff --git a/restapi/user_buckets_test.go b/restapi/user_buckets_test.go index 34a7751d3..680ca0def 100644 --- a/restapi/user_buckets_test.go +++ b/restapi/user_buckets_test.go @@ -217,7 +217,7 @@ func TestBucketInfo(t *testing.T) { bucketToSet := "csbucket" outputExpected := &models.Bucket{ Name: swag.String(bucketToSet), - Access: models.BucketAccessPRIVATE, + Access: models.NewBucketAccess(models.BucketAccessPRIVATE), CreationDate: "", // to be implemented Size: 0, // to be implemented } @@ -239,7 +239,7 @@ func TestBucketInfo(t *testing.T) { bucketToSet = "csbucket" outputExpected = &models.Bucket{ Name: swag.String(bucketToSet), - Access: models.BucketAccessPUBLIC, + Access: models.NewBucketAccess(models.BucketAccessPUBLIC), CreationDate: "", // to be implemented Size: 0, // to be implemented } @@ -261,7 +261,7 @@ func TestBucketInfo(t *testing.T) { bucketToSet = "csbucket" outputExpected = &models.Bucket{ Name: swag.String(bucketToSet), - Access: models.BucketAccessCUSTOM, + Access: models.NewBucketAccess(models.BucketAccessCUSTOM), CreationDate: "", // to be implemented Size: 0, // to be implemented } @@ -282,7 +282,7 @@ func TestBucketInfo(t *testing.T) { bucketToSet = "csbucket" outputExpected = &models.Bucket{ Name: swag.String(bucketToSet), - Access: models.BucketAccessCUSTOM, + Access: models.NewBucketAccess(models.BucketAccessCUSTOM), CreationDate: "", // to be implemented Size: 0, // to be implemented } @@ -299,7 +299,7 @@ func TestBucketInfo(t *testing.T) { bucketToSet = "csbucket" outputExpected = &models.Bucket{ Name: swag.String(bucketToSet), - Access: models.BucketAccessCUSTOM, + Access: models.NewBucketAccess(models.BucketAccessCUSTOM), CreationDate: "", // to be implemented Size: 0, // to be implemented } diff --git a/restapi/user_login.go b/restapi/user_login.go index e4f658f75..7800da3bd 100644 --- a/restapi/user_login.go +++ b/restapi/user_login.go @@ -194,7 +194,7 @@ func getLoginDetailsResponse() (*models.LoginDetails, *models.Error) { identityProvider := &auth.IdentityProvider{Client: oauth2Client} redirectURL = identityProvider.GenerateLoginURL() } else if acl.GetOperatorMode() { - loginStrategy = models.LoginDetailsLoginStrategyServiceAccount + loginStrategy = models.LoginDetailsLoginStrategyServiceDashAccount } loginDetails := &models.LoginDetails{ diff --git a/restapi/user_objects.go b/restapi/user_objects.go index 6d204ca77..fc5d2c347 100644 --- a/restapi/user_objects.go +++ b/restapi/user_objects.go @@ -508,7 +508,7 @@ func getSetObjectLegalHoldResponse(session *models.Principal, params user_api.Pu // create a minioClient interface implementation // defining the client to be used minioClient := minioClient{client: mClient} - err = setObjectLegalHold(ctx, minioClient, params.BucketName, params.Prefix, params.VersionID, params.Body.Status) + err = setObjectLegalHold(ctx, minioClient, params.BucketName, params.Prefix, params.VersionID, *params.Body.Status) if err != nil { return prepareError(err) } @@ -551,7 +551,7 @@ func setObjectRetention(ctx context.Context, client MinioClient, bucketName, ver } var mode minio.RetentionMode - if retentionOps.Mode == models.ObjectRetentionModeGovernance { + if *retentionOps.Mode == models.ObjectRetentionModeGovernance { mode = minio.Governance } else { mode = minio.Compliance diff --git a/restapi/user_objects_test.go b/restapi/user_objects_test.go index fa540e49e..e571af6d7 100644 --- a/restapi/user_objects_test.go +++ b/restapi/user_objects_test.go @@ -892,7 +892,7 @@ func Test_putObjectRetention(t *testing.T) { opts: &models.PutObjectRetentionRequest{ Expires: swag.String("2006-01-02T15:04:05Z"), GovernanceBypass: false, - Mode: models.ObjectRetentionModeGovernance, + Mode: models.NewObjectRetentionMode(models.ObjectRetentionModeGovernance), }, retentionFunc: func(ctx context.Context, bucketName, objectName string, opts minio.PutObjectRetentionOptions) error { return nil @@ -909,7 +909,7 @@ func Test_putObjectRetention(t *testing.T) { opts: &models.PutObjectRetentionRequest{ Expires: swag.String("2006-01-02T15:04:05Z"), GovernanceBypass: false, - Mode: models.ObjectRetentionModeCompliance, + Mode: models.NewObjectRetentionMode(models.ObjectRetentionModeCompliance), }, retentionFunc: func(ctx context.Context, bucketName, objectName string, opts minio.PutObjectRetentionOptions) error { return nil @@ -939,7 +939,7 @@ func Test_putObjectRetention(t *testing.T) { opts: &models.PutObjectRetentionRequest{ Expires: nil, GovernanceBypass: false, - Mode: models.ObjectRetentionModeCompliance, + Mode: models.NewObjectRetentionMode(models.ObjectRetentionModeCompliance), }, retentionFunc: func(ctx context.Context, bucketName, objectName string, opts minio.PutObjectRetentionOptions) error { return nil @@ -956,7 +956,7 @@ func Test_putObjectRetention(t *testing.T) { opts: &models.PutObjectRetentionRequest{ Expires: swag.String("invalidtime"), GovernanceBypass: false, - Mode: models.ObjectRetentionModeCompliance, + Mode: models.NewObjectRetentionMode(models.ObjectRetentionModeCompliance), }, retentionFunc: func(ctx context.Context, bucketName, objectName string, opts minio.PutObjectRetentionOptions) error { return nil @@ -973,7 +973,7 @@ func Test_putObjectRetention(t *testing.T) { opts: &models.PutObjectRetentionRequest{ Expires: swag.String("2006-01-02T15:04:05Z"), GovernanceBypass: false, - Mode: models.ObjectRetentionModeCompliance, + Mode: models.NewObjectRetentionMode(models.ObjectRetentionModeCompliance), }, retentionFunc: func(ctx context.Context, bucketName, objectName string, opts minio.PutObjectRetentionOptions) error { return errors.New("new Error")